Skip to content

Commit e92cea4

Browse files
authored
perf(worker): reset delays after generating blockTimeout value (#2529)
1 parent 8ed041e commit e92cea4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/classes/worker.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ export class Worker<
552552
try {
553553
this.blockUntil = await this.waiting;
554554

555-
if (this.blockUntil <= 0 || this.blockUntil - Date.now() < 10) {
555+
if (this.blockUntil <= 0 || this.blockUntil - Date.now() < 1) {
556556
return this.moveToActive(client, token, this.opts.name);
557557
}
558558
} catch (err) {
@@ -626,6 +626,7 @@ export class Worker<
626626
? blockTimeout
627627
: Math.ceil(blockTimeout);
628628

629+
this.updateDelays(); // reset delays to avoid reusing same values in next iteration
629630
// Markers should only be used for un-blocking, so we will handle them in this
630631
// function only.
631632
const result = await bclient.bzpopmin(this.keys.marker, blockTimeout);

0 commit comments

Comments
 (0)