From 91789b9e32c3c02a0f454dbe287d4be40f7f572f Mon Sep 17 00:00:00 2001 From: Omar Brikaa Date: Fri, 30 Sep 2022 14:27:34 +0200 Subject: [PATCH] Don't let an external websocket close cause a cleanup --- api/src/api/v2.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/api/src/api/v2.js b/api/src/api/v2.js index 9cb5c36..6ac1b94 100644 --- a/api/src/api/v2.js +++ b/api/src/api/v2.js @@ -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');