🏗️ Fixed setQueueStatus

This commit is contained in:
2023-11-14 13:24:49 -06:00
parent b8ca03220f
commit c2bbbf311d

View File

@@ -26,7 +26,7 @@ export default class SocketService extends Service {
"/": { "/": {
events: { events: {
call: { call: {
whitelist: ["socket.resumeSession"], whitelist: ["socket.*"],
}, },
// async (data) => { // async (data) => {
@@ -143,8 +143,12 @@ export default class SocketService extends Service {
if (active > 0) { if (active > 0) {
// 3. Get job counts // 3. Get job counts
const completedJobCount = await pubClient.get("completedJobCount"); const completedJobCount = await pubClient.get(
const failedJobCount = await pubClient.get("failedJobCount"); "completedJobCount"
);
const failedJobCount = await pubClient.get(
"failedJobCount"
);
// 4. Send the counts to the active socket.io session // 4. Send the counts to the active socket.io session
await this.broker.call("socket.broadcast", { await this.broker.call("socket.broadcast", {
@@ -161,17 +165,27 @@ export default class SocketService extends Service {
} }
} }
} catch (err) { } catch (err) {
throw new MoleculerError(err, 500, "SESSION_ID_NOT_FOUND", { throw new MoleculerError(
data: sessionId, err,
}); 500,
"SESSION_ID_NOT_FOUND",
{
data: sessionId,
}
);
} }
}, },
setQueueStatus: async (ctx: Context<{}>) => { setQueueStatus: async (
console.log(data); ctx: Context<{
queueAction: string;
queueStatus: string;
}>
) => {
const { queueAction } = ctx.params;
await this.broker.call( await this.broker.call(
"jobqueue.toggle", "jobqueue.toggle",
{ action: data.data.queueAction }, { action: queueAction },
{} {}
); );
}, },