refactor: use switch for receiving IPC messages

This commit is contained in:
Johann150 2023-05-12 19:18:17 +02:00
parent ac81acfe9d
commit e6c7f4b693
Signed by untrusted user: Johann150
GPG key ID: 9EE6577A2A06F8F1

View file

@ -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') {
bootLogger.error('The server Listen failed due to the previous error.');
process.exit(1);
switch (message) {
case 'listenFailed':
bootLogger.error('The server Listen failed due to the previous error.');
process.exit(1);
break;
case 'ready':
res();
break;
}
if (message !== 'ready') return;
res();
});
});
}