From cfa09691e8969b56366d06f955bff15e2da2c9ef Mon Sep 17 00:00:00 2001 From: Rishi Ghan Date: Wed, 30 Aug 2023 12:21:43 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Fixed=20an=20errant=20condition?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This error was because I checked for active AND prioritized jobs in BullMQ, when none existed, because everything was active, and the socket.io event never fired, causing the browser to be in a bad state and never "resuming" an import even when one was in progress. --- services/socket.service.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/services/socket.service.ts b/services/socket.service.ts index b09627e..e48bde5 100644 --- a/services/socket.service.ts +++ b/services/socket.service.ts @@ -47,9 +47,9 @@ export default class SocketService extends Service { "jobqueue.getJobCountsByType", {} ); - const { active, prioritized } = jobs; + const { active } = jobs; - if (active > 0 && prioritized > 0) { + if (active > 0) { // 3. Get job counts const completedJobCount = await pubClient.get( @@ -149,6 +149,7 @@ export default class SocketService extends Service { console.log( `Found socketId ${socket.id}, attempting to resume socket.io connection...` ); + console.log(socket.handshake.query.sessionId); } }); },