fix(run-engine,core): non-blocking test polls and document the zero total limit

The waitFor polls dequeued with the default 10s blocking pop, which could
blow past the helper deadline on a slow runner; poll non-blocking instead.
Document that totalConcurrencyLimit: 0 holds every keyed run, matching
concurrencyLimit's zero semantics.
This commit is contained in:
Matt Aitken
2026-08-28 19:14:53 +01:00
parent f8cbd71f4c
commit 8cae45ed24
2 changed files with 9 additions and 2 deletions
@@ -286,7 +286,9 @@ describe("RunQueue total concurrency limit", () => {
});
const r1Admitted = await waitFor(async () => {
const next = await queue.dequeueMessageFromWorkerQueue("consumer-1", "main");
const next = await queue.dequeueMessageFromWorkerQueue("consumer-1", "main", {
blockingPop: false,
});
return next?.messageId === "r1";
});
expect(r1Admitted).toBe(true);
@@ -350,7 +352,9 @@ describe("RunQueue total concurrency limit", () => {
});
const r1Admitted = await waitFor(async () => {
const next = await queue.dequeueMessageFromWorkerQueue("consumer-1", "main");
const next = await queue.dequeueMessageFromWorkerQueue("consumer-1", "main", {
blockingPop: false,
});
return next?.messageId === "r1";
});
expect(r1Admitted).toBe(true);
+3
View File
@@ -54,6 +54,9 @@ export type QueueOptions = {
* ```
*
* Only enforced for runs triggered with a `concurrencyKey`, and requires server-side support.
*
* Omit for no total cap. Like `concurrencyLimit`, a value of `0` holds every keyed run in
* the queue rather than removing the cap.
*/
totalConcurrencyLimit?: number;
};