Skip to content

Commit f1d1ebe

Browse files
committed
okay actually fix
1 parent 02db168 commit f1d1ebe

File tree

1 file changed

+8
-0
lines changed
  • packages/redis-worker/src/fair-queue

1 file changed

+8
-0
lines changed

packages/redis-worker/src/fair-queue/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -909,6 +909,8 @@ export class FairQueue<TPayloadSchema extends z.ZodTypeAny = z.ZodUnknown> {
909909
if (this.concurrencyManager) {
910910
const check = await this.concurrencyManager.canProcess(descriptor);
911911
if (!check.allowed) {
912+
// Queue at max concurrency, back off to avoid repeated attempts
913+
this.#incrementCooloff(queueId);
912914
return false;
913915
}
914916
}
@@ -958,6 +960,8 @@ export class FairQueue<TPayloadSchema extends z.ZodTypeAny = z.ZodUnknown> {
958960
queueItemsKey,
959961
masterQueueKey
960962
);
963+
// Concurrency reservation failed, back off to avoid repeated attempts
964+
this.#incrementCooloff(queueId);
961965
return false;
962966
}
963967
}
@@ -1253,6 +1257,8 @@ export class FairQueue<TPayloadSchema extends z.ZodTypeAny = z.ZodUnknown> {
12531257
if (this.concurrencyManager) {
12541258
const check = await this.concurrencyManager.canProcess(descriptor);
12551259
if (!check.allowed) {
1260+
// Queue at max concurrency, back off to avoid repeated attempts
1261+
this.#incrementCooloff(queueId);
12561262
return false;
12571263
}
12581264
}
@@ -1302,6 +1308,8 @@ export class FairQueue<TPayloadSchema extends z.ZodTypeAny = z.ZodUnknown> {
13021308
queueItemsKey,
13031309
masterQueueKey
13041310
);
1311+
// Concurrency reservation failed, back off to avoid repeated attempts
1312+
this.#incrementCooloff(queueId);
13051313
return false;
13061314
}
13071315
}

0 commit comments

Comments
 (0)