Skip to content

Commit e73840d

Browse files
committed
docs: the global-cap gate pattern requires keyed triggers
The combined limit only counts keyed runs, so the shared-resource example now shows the keyed trigger and warns that keyless runs bypass the cap, pointing those cases at the pinned-key pool.
1 parent ab4c607 commit e73840d

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

docs/queue-concurrency.mdx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,17 @@ export const syncToProvider = task({
247247
});
248248
```
249249

250+
```ts app/api/sync/route.ts
251+
//the combined cap only counts keyed runs, so every trigger passes a key
252+
await syncToProvider.trigger(payload, { concurrencyKey: tenantId });
253+
```
254+
255+
<Warning>
256+
This pattern requires every trigger to pass a `concurrencyKey`. A run triggered without one
257+
bypasses the combined limit entirely. If some runs have no natural key, use the pinned-key
258+
pool below instead.
259+
</Warning>
260+
250261
### One shared pool ignoring keys
251262

252263
Give a gate a literal `concurrencyKey` to pin every run into a single first-come-first-served pool, regardless of each run's own key:

0 commit comments

Comments
 (0)