Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

Update queue-worker.ts

Nicolas92dbd33e57f0
diff --git a/apps/api/src/services/queue-worker.ts b/apps/api/src/services/queue-worker.ts
index 050d672de..b18f372bb 100644
--- a/apps/api/src/services/queue-worker.ts
+++ b/apps/api/src/services/queue-worker.ts
@@ -148,6 +148,11 @@ const workerFun = async (
await redisConnection.zadd(concurrencyLimiterThrottledKey, now + throttledJobTimeoutMs, job.id);
await job.moveToFailed(new Error("Concurrency limit hit"), token, false);
await job.remove();
+ let newJobPriority = Math.round((job.opts.priority ?? 10) * 1.01);
+ // max priority is 200k, limit is 2 million
+ if(newJobPriority > 200000) {
+ newJobPriority = 200000;
+ }
await queue.add(job.name, {
...job.data,
concurrencyLimitHit: true,