Don't let an external websocket close cause a cleanup

This commit is contained in:
Omar Brikaa 2022-09-30 14:27:34 +02:00
parent 993d5c6fb0
commit 91789b9e32
1 changed files with 1 additions and 6 deletions

View File

@ -219,6 +219,7 @@ router.ws('/connect', async (ws, req) => {
);
await job.execute_interactive(eventBus);
await job.cleanup();
ws.close(4999, 'Job Completed');
} else {
@ -255,12 +256,6 @@ router.ws('/connect', async (ws, req) => {
}
});
ws.on('close', async () => {
if (job !== null) {
await job.cleanup();
}
});
setTimeout(() => {
//Terminate the socket after 1 second, if not initialized.
if (job === null) ws.close(4001, 'Initialization Timeout');