forked from FoundKeyGang/FoundKey
refactor: use switch for receiving IPC messages
This commit is contained in:
parent
ac81acfe9d
commit
e6c7f4b693
1 changed files with 8 additions and 5 deletions
|
@ -160,12 +160,15 @@ function spawnWorker(mode: 'web' | 'queue'): Promise<void> {
|
|||
return new Promise(res => {
|
||||
const worker = cluster.fork({ mode });
|
||||
worker.on('message', message => {
|
||||
if (message === 'listenFailed') {
|
||||
switch (message) {
|
||||
case 'listenFailed':
|
||||
bootLogger.error('The server Listen failed due to the previous error.');
|
||||
process.exit(1);
|
||||
}
|
||||
if (message !== 'ready') return;
|
||||
break;
|
||||
case 'ready':
|
||||
res();
|
||||
break;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue