Skip to content

feat: Max task concurrency irrespective of the tenant queue #3235

Open

Description

@gautamsi

Is your feature request related to a problem? Please describe.

I have to process 1000s of images and I have third party api rate limit of 20 parallel processing.
I want to allow user to be able to consume only 1 concurrency while maintaining task concurrency to 20
As soon as I use concurrency key it takes 1 per user but does not respect 20 limit and tasks start failing.

similar scenario, I like to process my order webhooks in parallel but I have to make sure I am processing webhooks for each order in sequence. I dont want to spin 100s of workers and block all other tasks while working on each order separately.

Describe the solution you'd like to see

There should be a config maxGlobalConcurrency: 10 in task definition and that should be respected when spinning workers. by default this value can be the global environment limit in case the value is not provided. this way there is no change needed to existing task definitions.

Describe alternate solutions

Not explored

Additional information

No response

Activity

  1. mohammedshukur84-wq commented on Aug 25, 2026

    @mohammedshukur84-wq

    Hi Trigger.dev team — I came across this request for a task-level global concurrency cap that still works alongside per-tenant / per-key concurrency, and built a small interactive proof of concept to explore the behavior.

    The demo covers:

    • maxGlobalConcurrency style task-level limit
    • Per-user concurrency limits
    • Queuing when the global cap is reached
    • Burst simulation for large workloads
    • External API rate-limit protection
    • Running vs queued job visibility

    Live demo:
    https://triggerdev-concurrency-control-demo.vercel.app

    This is a proof of concept rather than a production implementation, but it demonstrates the scheduling behavior described in the issue. If the direction is useful, I'd be happy to discuss how it could map onto Trigger.dev's existing queue and worker model.

  2. samarthyadavv commented on Nov 10, 2026

    @samarthyadavv

    Hi @gautamsi, I'd be interested in contributing a production implementation of this feature.

    I've worked with Redis-backed asynchronous job processing, backend services, and distributed systems, and this looks like an interesting scheduling challenge.

    My initial approach would be to introduce a task-level maxGlobalConcurrency limit that works alongside existing per-key concurrency controls.

    I'd investigate the current queue scheduling and concurrency enforcement mechanisms, then implement a solution that enforces both limits atomically, prevents over-dispatching, and releases capacity correctly when tasks complete, fail, or retry.

    I'd also include tests for concurrent workers, per-key ordering, global limits, and backward compatibility.

    I noticed the existing proof of concept and would focus on integrating this behavior into the actual scheduling infrastructure rather than building another demo.

    Would the maintainers be open to this approach? I'd be happy to work on the implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions