Skip to content

Commit

Permalink
chore: remove unnecessary statement
Browse files Browse the repository at this point in the history
  • Loading branch information
manast committed Apr 7, 2024
1 parent abce3c3 commit f875ddd
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/classes/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -431,8 +431,18 @@ export class Worker<
const client = await this.client;
const bclient = await this.blockingConnection.client;

/**
* This is the main loop in BullMQ. Its goals are to fetch jobs from the queue
* as efficiently as possible, providing concurrency and minimal unnecessary calls
* to Redis.
*/
while (!this.closing) {
let numTotal = asyncFifoQueue.numTotal();

/**
* This inner loop tries to fetch jobs concurrently, but if we are waiting for a job
* to arrive at the queue we should not try to fetch more jobs (as it would be pointless)
*/
while (
!this.waiting &&
numTotal < this.opts.concurrency &&
Expand Down Expand Up @@ -636,8 +646,6 @@ export class Worker<
if (!this.closing) {
await this.delay();
}
} finally {
this.waiting = null;
}
return Infinity;
}
Expand Down

0 comments on commit f875ddd

Please sign in to comment.