🏗 Implemented setQueueStatus
This commit is contained in:
@@ -124,7 +124,6 @@ export default class SocketService extends Service {
|
|||||||
actions: {
|
actions: {
|
||||||
resumeSession: async (ctx: Context<{ sessionId: string }>) => {
|
resumeSession: async (ctx: Context<{ sessionId: string }>) => {
|
||||||
const { sessionId } = ctx.params;
|
const { sessionId } = ctx.params;
|
||||||
console.log("asdasdA");
|
|
||||||
console.log("Attempting to resume session...");
|
console.log("Attempting to resume session...");
|
||||||
try {
|
try {
|
||||||
const sessionRecord = await Session.find({
|
const sessionRecord = await Session.find({
|
||||||
@@ -144,12 +143,8 @@ 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(
|
const completedJobCount = await pubClient.get("completedJobCount");
|
||||||
"completedJobCount"
|
const failedJobCount = await pubClient.get("failedJobCount");
|
||||||
);
|
|
||||||
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", {
|
||||||
@@ -166,16 +161,20 @@ export default class SocketService extends Service {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw new MoleculerError(
|
throw new MoleculerError(err, 500, "SESSION_ID_NOT_FOUND", {
|
||||||
err,
|
data: sessionId,
|
||||||
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: {},
|
methods: {},
|
||||||
async started() {
|
async started() {
|
||||||
|
|||||||
Reference in New Issue
Block a user