Skip to content

Commit f62dde7

Browse files
committed
docs: per-key home cap wording, combined field always present, reset body required
The gates intro promised a task-wide cap the keyed example does not deliver (a concurrencyKey splits the home queue per key); the combined object is emitted on every queue with null fields rather than omitted; and both reset endpoints reject a zero-length body, so the body is required. Also restores the example that drifted off overriddenAt.
1 parent 533bb82 commit f62dde7

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

docs/queue-concurrency.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ The combined limit only applies to runs triggered with a `concurrencyKey`; runs
183183

184184
## Holding slots in more than one queue (queue gates)
185185

186-
Sometimes one limit isn't enough: a webhook processor should be capped as a task, but each tenant should also have a global cap across every task they run. Queue gates let a run hold a concurrency slot in more than one queue at once.
186+
Sometimes one limit isn't enough: each tenant's webhook processing should be capped, but the tenant should also have a global cap across every task they run. Queue gates let a run hold a concurrency slot in more than one queue at once.
187187

188188
Pass an array as `queue`: the first entry is the run's home queue (where it waits), and up to two more entries name gates — other queues the run must also have capacity in before it starts, and occupies while it executes:
189189

@@ -204,6 +204,8 @@ export const processWebhook = task({
204204
await processWebhook.trigger(payload, { concurrencyKey: tenantId });
205205
```
206206

207+
Because the trigger passes a `concurrencyKey`, the home queue splits per key as usual: `concurrencyLimit: 2` caps each tenant's webhook runs, not the task overall (add a `combinedConcurrencyLimit` to the home queue to bound it across all tenants).
208+
207209
A gate without a `concurrencyKey` uses the run's own key, so the shared `tenant` queue above caps each tenant across every task that names it as a gate. Give the gate a literal key to pin it to a single slot pool instead, for example capping all traffic to one external provider across your whole environment:
208210

209211
```ts /trigger/sync.ts

docs/v3-openapi.yaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3136,7 +3136,8 @@ paths:
31363136
description: The queue ID (e.g., `queue_1234`), or the name of the queue when using the `type` body parameter.
31373137
example: queue_1234
31383138
requestBody:
3139-
required: false
3139+
required: true
3140+
description: At least an empty JSON object `{}` must be sent; a zero-length body is rejected with a 400.
31403141
content:
31413142
application/json:
31423143
schema:
@@ -3190,7 +3191,8 @@ paths:
31903191
description: The queue ID (e.g., `queue_1234`), or the name of the queue when using the `type` body parameter.
31913192
example: queue_1234
31923193
requestBody:
3193-
required: false
3194+
required: true
3195+
description: At least an empty JSON object `{}` must be sent; a zero-length body is rejected with a 400.
31943196
content:
31953197
application/json:
31963198
schema:
@@ -4449,11 +4451,13 @@ components:
44494451
format: date-time
44504452
nullable: true
44514453
description: When the concurrency limit was overridden
4454+
example: null
44524455
combined:
44534456
type: object
44544457
description: |
44554458
The combined concurrency cap across all `concurrencyKey` values of the queue.
4456-
Present when the queue has a `combinedConcurrencyLimit`.
4459+
Always present; `current` is null when the queue has no combined limit, so
4460+
check `combined.current !== null` rather than the field's presence.
44574461
properties:
44584462
current:
44594463
type: integer
@@ -4480,7 +4484,6 @@ components:
44804484
nullable: true
44814485
description: Runs currently in flight across all concurrencyKey values
44824486
example: 4
4483-
example: null
44844487
overriddenBy:
44854488
type: string
44864489
nullable: true

0 commit comments

Comments
 (0)