From b8ca03220f2e0cac803387f237b66417174ff64c Mon Sep 17 00:00:00 2001 From: Rishi Ghan Date: Mon, 13 Nov 2023 22:01:01 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=8F=97=20Implemented=20setQueueStatus?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/socket.service.ts | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/services/socket.service.ts b/services/socket.service.ts index dba9f4d..64393d9 100644 --- a/services/socket.service.ts +++ b/services/socket.service.ts @@ -124,7 +124,6 @@ export default class SocketService extends Service { actions: { resumeSession: async (ctx: Context<{ sessionId: string }>) => { const { sessionId } = ctx.params; - console.log("asdasdA"); console.log("Attempting to resume session..."); try { const sessionRecord = await Session.find({ @@ -144,12 +143,8 @@ export default class SocketService extends Service { if (active > 0) { // 3. Get job counts - const completedJobCount = await pubClient.get( - "completedJobCount" - ); - const failedJobCount = await pubClient.get( - "failedJobCount" - ); + const completedJobCount = await pubClient.get("completedJobCount"); + const failedJobCount = await pubClient.get("failedJobCount"); // 4. Send the counts to the active socket.io session await this.broker.call("socket.broadcast", { @@ -166,16 +161,20 @@ export default class SocketService extends Service { } } } catch (err) { - throw new MoleculerError( - err, - 500, - "SESSION_ID_NOT_FOUND", - { - data: sessionId, - } - ); + throw new MoleculerError(err, 500, "SESSION_ID_NOT_FOUND", { + data: sessionId, + }); } }, + + setQueueStatus: async (ctx: Context<{}>) => { + console.log(data); + await this.broker.call( + "jobqueue.toggle", + { action: data.data.queueAction }, + {} + ); + }, }, methods: {}, async started() {