Skip to content

Commit

Permalink
feat: add support for getWorkersCount
Browse files Browse the repository at this point in the history
  • Loading branch information
manast committed Apr 7, 2024
1 parent 9c550c1 commit f07db90
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 5 additions & 2 deletions lib/responders/bull-responders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function paginate(
start = start || 0;
end = end || -1;
return (<any>queue)
[method](start, end, opts)
[method](start, end, opts)
.then(function (jobs: Bull.Job[]) {
respond(ws, messageId, jobs);
});
Expand Down Expand Up @@ -100,10 +100,13 @@ async function respondQueueCommand(
case "getCompletedCount":
case "getFailedCount":
case "getRepeatableCount":
case "getWorkersCount":
const count = await (<any>queue)[data.cmd]();
respond(ws, msg.id, count);
break;
case "getWorkersCount":
const workers = await queue.getWorkers();
respond(ws, msg.id, workers.length);
break;
case "removeRepeatableByKey":
await queue.removeRepeatableByKey(data.key);
respond(ws, msg.id);
Expand Down
5 changes: 4 additions & 1 deletion lib/responders/bullmq-responders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,13 @@ async function respondQueueCommand(
case "getCompletedCount":
case "getFailedCount":
case "getRepeatableCount":
case "getWorkersCount":
const count = await (<any>queue)[data.cmd]();
respond(ws, msg.id, count);
break;
case "getWorkersCount":
const workers = await queue.getWorkers();
respond(ws, msg.id, workers.length);
break;
case "removeRepeatableByKey":
await queue.removeRepeatableByKey(data.key);
respond(ws, msg.id);
Expand Down

0 comments on commit f07db90

Please sign in to comment.