@trigger.dev/redis-worker 0.0.0-prerelease-20260302145933 → 0.0.0-prerelease-20260304181730
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +11 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -3
- package/dist/index.d.ts +18 -3
- package/dist/index.js +11 -11
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -14909,7 +14909,8 @@ var FairQueue = class {
|
|
|
14909
14909
|
this.cooloffThreshold = options.cooloff?.threshold ?? 10;
|
|
14910
14910
|
this.cooloffPeriodMs = options.cooloff?.periodMs ?? 1e4;
|
|
14911
14911
|
this.maxCooloffStatesSize = options.cooloff?.maxStatesSize ?? 1e3;
|
|
14912
|
-
this.
|
|
14912
|
+
this.workerQueueMaxDepth = options.workerQueueMaxDepth ?? 0;
|
|
14913
|
+
this.workerQueueDepthCheckId = options.workerQueueDepthCheckId;
|
|
14913
14914
|
this.consumerTraceMaxIterations = options.consumerTraceMaxIterations ?? 500;
|
|
14914
14915
|
this.consumerTraceTimeoutSeconds = options.consumerTraceTimeoutSeconds ?? 60;
|
|
14915
14916
|
this.telemetry = new FairQueueTelemetry({
|
|
@@ -14995,8 +14996,9 @@ var FairQueue = class {
|
|
|
14995
14996
|
cooloffPeriodMs;
|
|
14996
14997
|
maxCooloffStatesSize;
|
|
14997
14998
|
queueCooloffStates = /* @__PURE__ */ new Map();
|
|
14998
|
-
//
|
|
14999
|
-
|
|
14999
|
+
// Worker queue backpressure
|
|
15000
|
+
workerQueueMaxDepth;
|
|
15001
|
+
workerQueueDepthCheckId;
|
|
15000
15002
|
// Consumer tracing
|
|
15001
15003
|
consumerTraceMaxIterations;
|
|
15002
15004
|
consumerTraceTimeoutSeconds;
|
|
@@ -15700,15 +15702,13 @@ var FairQueue = class {
|
|
|
15700
15702
|
}
|
|
15701
15703
|
maxClaimCount = Math.min(maxClaimCount, availableCapacity);
|
|
15702
15704
|
}
|
|
15703
|
-
if (this.
|
|
15704
|
-
const
|
|
15705
|
-
if (
|
|
15706
|
-
|
|
15707
|
-
if (waitMs > 0) {
|
|
15708
|
-
this.logger.debug("Global rate limit reached, waiting", { waitMs, loopId });
|
|
15709
|
-
await new Promise((resolve) => setTimeout(resolve, waitMs));
|
|
15710
|
-
}
|
|
15705
|
+
if (this.workerQueueMaxDepth > 0 && this.workerQueueDepthCheckId) {
|
|
15706
|
+
const depth = await this.workerQueueManager.getLength(this.workerQueueDepthCheckId);
|
|
15707
|
+
if (depth >= this.workerQueueMaxDepth) {
|
|
15708
|
+
return 0;
|
|
15711
15709
|
}
|
|
15710
|
+
const remainingCapacity = this.workerQueueMaxDepth - depth;
|
|
15711
|
+
maxClaimCount = Math.min(maxClaimCount, remainingCapacity);
|
|
15712
15712
|
}
|
|
15713
15713
|
const claimedMessages = await this.visibilityManager.claimBatch(queueId, queueKey, queueItemsKey, loopId, maxClaimCount, this.visibilityTimeoutMs);
|
|
15714
15714
|
if (claimedMessages.length === 0) {
|