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 => {
|
return new Promise(res => {
|
||||||
const worker = cluster.fork({ mode });
|
const worker = cluster.fork({ mode });
|
||||||
worker.on('message', message => {
|
worker.on('message', message => {
|
||||||
if (message === 'listenFailed') {
|
switch (message) {
|
||||||
bootLogger.error('The server Listen failed due to the previous error.');
|
case 'listenFailed':
|
||||||
process.exit(1);
|
bootLogger.error('The server Listen failed due to the previous error.');
|
||||||
|
process.exit(1);
|
||||||
|
break;
|
||||||
|
case 'ready':
|
||||||
|
res();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (message !== 'ready') return;
|
|
||||||
res();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue