Skip to content

docs: combined concurrency limits and queue gates - #4853

Open
matt-aitken wants to merge 9 commits into
feat/queue-concurrency-metricsfrom
docs/queue-concurrency-features
Open

docs: combined concurrency limits and queue gates#4853
matt-aitken wants to merge 9 commits into
feat/queue-concurrency-metricsfrom
docs/queue-concurrency-features

Conversation

@matt-aitken

Copy link
Copy Markdown
Member

Summary

Documents the queue concurrency features shipping in this stack: the combinedConcurrencyLimit queue option that caps a keyed queue across all of its concurrencyKey values, queue gates (array queue syntax for holding a slot in more than one queue), and the combined override/reset SDK methods and endpoints.

The concurrency guide gains sections on combined limits and gates with self-hosting notes for the server flags, the OpenAPI spec gains the two combined endpoints and the concurrency.combined response field, and the management reference gains pages for both new endpoints.

Stacked on #4830.

@changeset-bot

changeset-bot Bot commented Aug 31, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 7038e96

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 524dbd1f-5cfa-4c64-8de1-a26e10cfb732

📥 Commits

Reviewing files that changed from the base of the PR and between eb33462 and e07558e.

📒 Files selected for processing (1)
  • docs/queue-concurrency.mdx
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/queue-concurrency.mdx

Included review availability: Your plan provides up to 10 included reviews per hour; 3 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout. (3)
  • GitHub Check: code-quality / code-quality
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Build and publish previews

Walkthrough

The OpenAPI specification adds combined concurrency override and reset endpoints. It documents combined concurrency state on QueueObject and requires a request body for the existing reset endpoint. The queue concurrency guide adds combined-limit patterns, gate queue examples, tenant and shared-resource limits, and SDK override and reset methods. Documentation navigation adds separate pages for the new endpoints.

Merge Risk: ⚪ Minimal · up to 7038e

This change documents combined queue concurrency APIs, configuration, and usage patterns. No current merge-blocking risk is identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description accurately summarizes the documentation changes, but it does not follow the repository template. It omits the required checklist, testing details, changelog, screenshots section, and i… Add the required template sections. Include the relevant issue reference, complete the checklist, describe testing performed, add a short changelog entry, and include the screenshots section or state that screenshots are not applicable.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main documentation changes for combined concurrency limits and queue gates. It is concise and specific.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description accurately summarizes the documentation changes, but it does not follow the repository template. It omits the required checklist, testing details, changelog, screenshots section, and issue-closing line.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/queue-concurrency-features

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

devin-ai-integration[bot]

This comment was marked as resolved.

@matt-aitken
matt-aitken force-pushed the docs/queue-concurrency-features branch 2 times, most recently from 05bef1a to 7998d68 Compare August 31, 2026 17:34
devin-ai-integration[bot]

This comment was marked as resolved.

@matt-aitken
matt-aitken force-pushed the docs/queue-concurrency-features branch 5 times, most recently from af1ed4f to ab4c607 Compare August 31, 2026 18:13
@matt-aitken
matt-aitken force-pushed the docs/queue-concurrency-features branch from e73840d to 34b2cfb Compare September 6, 2026 12:20
@pkg-pr-new

pkg-pr-new Bot commented Sep 6, 2026

Copy link
Copy Markdown

Open in StackBlitz

@trigger.dev/build

npm i https://pkg.pr.new/@trigger.dev/build@7038e96

trigger.dev

npm i https://pkg.pr.new/trigger.dev@7038e96

@trigger.dev/core

npm i https://pkg.pr.new/@trigger.dev/core@7038e96

@trigger.dev/python

npm i https://pkg.pr.new/@trigger.dev/python@7038e96

@trigger.dev/react-hooks

npm i https://pkg.pr.new/@trigger.dev/react-hooks@7038e96

@trigger.dev/redis-worker

npm i https://pkg.pr.new/@trigger.dev/redis-worker@7038e96

@trigger.dev/rsc

npm i https://pkg.pr.new/@trigger.dev/rsc@7038e96

@trigger.dev/schema-to-json

npm i https://pkg.pr.new/@trigger.dev/schema-to-json@7038e96

@trigger.dev/sdk

npm i https://pkg.pr.new/@trigger.dev/sdk@7038e96

commit: 7038e96

coderabbitai[bot]

This comment was marked as resolved.

@matt-aitken
matt-aitken force-pushed the docs/queue-concurrency-features branch from 34b2cfb to 947879a Compare September 6, 2026 12:33
@matt-aitken
matt-aitken force-pushed the docs/queue-concurrency-features branch from 947879a to 2e0ae55 Compare September 6, 2026 12:37
@matt-aitken
matt-aitken force-pushed the docs/queue-concurrency-features branch from 2e0ae55 to 1772166 Compare September 6, 2026 12:45
coderabbitai[bot]

This comment was marked as resolved.

@matt-aitken
matt-aitken force-pushed the docs/queue-concurrency-features branch 2 times, most recently from 99fc054 to 7cd93f1 Compare September 6, 2026 13:00
@matt-aitken
matt-aitken force-pushed the docs/queue-concurrency-features branch from 7cd93f1 to 2250f8e Compare September 6, 2026 13:14
@matt-aitken
matt-aitken force-pushed the docs/queue-concurrency-features branch from 2250f8e to b70f42a Compare September 6, 2026 13:20
@matt-aitken
matt-aitken force-pushed the docs/queue-concurrency-features branch from b70f42a to b4d89eb Compare September 6, 2026 13:21
@matt-aitken
matt-aitken force-pushed the docs/queue-concurrency-features branch from b4d89eb to 56a9526 Compare September 6, 2026 13:23
@matt-aitken
matt-aitken force-pushed the docs/queue-concurrency-features branch from 56a9526 to eb33462 Compare September 6, 2026 13:24
coderabbitai[bot]

This comment was marked as resolved.

@matt-aitken
matt-aitken force-pushed the docs/queue-concurrency-features branch from eb33462 to d1e4a7c Compare September 6, 2026 14:09
@matt-aitken
matt-aitken force-pushed the docs/queue-concurrency-features branch from d1e4a7c to e07558e Compare September 6, 2026 14:16

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 4 new potential issues.

Devin Review

Comment on lines +199 to +207
Pass an array as `queue`: the first entry is the home queue, the rest name gates. The same array form works when you trigger, replacing the task's gates for that run:

```ts
import { processWebhook } from "~/trigger/webhooks";

await processWebhook.trigger(payload, {
queue: ["webhooks", "tenant"],
concurrencyKey: tenantId,
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Queue gate examples cannot compile

Passing an array through queue fails because task definitions and triggers accept only one queue. Users cannot implement any documented gate pattern.

Prompt for agents
Rewrite the “Using multiple queues at once” section in docs/queue-concurrency.mdx around the current public concurrency API. Task queue accepts only a string or queue object, and trigger-time queue accepts only a string. Multiple shared limits use concurrencyLimit({ name, perKey?, total? }) and the task concurrency array. Trigger-time overrides use the trigger option concurrency with one or two named limit strings. Update every gate example and the home-queue/gate terminology to match these APIs.
Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +179 to +185
export const perUserQueue = queue({
name: "per-user-queue",
//each user runs at most 1 at a time...
concurrencyLimit: 1,
//...and at most 10 total runs across all users
combinedConcurrencyLimit: 10,
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Combined limit examples cannot compile

Passing combinedConcurrencyLimit to queue() fails because public queue options do not define it. Users cannot create either documented combined-limit configuration.

Prompt for agents
Replace the legacy combinedConcurrencyLimit queue examples and semantics in docs/queue-concurrency.mdx with the current public concurrency API. For a task-wide cap, use task({ concurrency: { perKey, total } }). For a shared cap, declare concurrencyLimit({ name, perKey?, total? }) and reference it from each task’s concurrency option. Ensure the text reflects that total caps all runs, including runs without concurrencyKey, as documented by the current types.
Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +495 to +502
```ts
import { queues } from "@trigger.dev/sdk";

// Allow up to 100 runs across all concurrency keys
await queues.overrideCombinedConcurrencyLimit("queue_1234", 100);

// Revert to the combinedConcurrencyLimit declared in your code
await queues.resetCombinedConcurrencyLimit("queue_1234");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Combined override samples cannot compile

The queues namespace exports neither documented combined-limit method. Every new SDK sample fails before it can call the available HTTP endpoints.

Prompt for agents
Align the combined override/reset documentation with the SDK currently shipped on this branch. Either implement and export overrideCombinedConcurrencyLimit and resetCombinedConcurrencyLimit through packages/core and packages/trigger-sdk, or remove the SDK calls from docs/queue-concurrency.mdx and the x-codeSamples for both new OpenAPI operations and document direct HTTP usage instead. Keep the guide and generated management reference consistent.
Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Comment thread docs/v3-openapi.yaml
Comment on lines +4455 to +4487
combined:
type: object
description: |
The combined concurrency cap across all `concurrencyKey` values of the queue.
Servers on this version always emit it, with `current` null when the queue
has no combined limit; older servers may omit the field entirely, so check
`combined?.current != null` rather than relying on its presence.
properties:
current:
type: integer
nullable: true
description: The current combined concurrency limit as declared or overridden (null = no cap). Enforcement clamps it to the environment concurrency limit at admit time.
example: 10
base:
type: integer
nullable: true
description: The declared combined limit an override reverts to on reset
example: 10
override:
type: integer
nullable: true
description: The overridden combined limit, when an override is active
example: null
overriddenAt:
type: string
format: date-time
nullable: true
description: When the combined override was applied
running:
type: integer
nullable: true
description: Runs currently in flight across all concurrencyKey values
example: 4

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Combined override actor is absent

combined exposes overriddenAt but no actor. The sibling overriddenBy describes only ordinary overrides, leaving combined override provenance unavailable.

Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

…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.
A Use cases index links each goal to its section, the multi-queue
section names the home queue and gate concepts once and gives each
pattern its own worked example (per-tenant cap across tasks, global cap
for a shared resource via a combined-only queue, pinned-key shared
pool), and the per-key-except-combined rule gets a warning callout.
Folds in the simplified wording and removes self-hosting notes.
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.
@matt-aitken
matt-aitken force-pushed the docs/queue-concurrency-features branch from e07558e to 7038e96 Compare September 6, 2026 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant