Conversation
Define RateLimitRequest and RateLimitCheckResult interfaces to support pre-processing rate limit checks. Update existing queue and job definitions to include optional rate limit configurations. This change allows workers to enforce granular concurrency and rate limiting policies by passing request metadata through the task payload and worker queue structures.
Implement the RateLimitManager class to support atomic multi-key rate limiting using Lua scripts. Add support for static configurations and dynamic consumption tracking to ensure consistent rate management across worker processes.
Add a comprehensive test suite for the RateLimitManager class to ensure correct rate limiting behavior, atomicity of operations, proper cleanup, and TTL management for Redis keys.
Integrate RateLimitManager into the FairQueue workflow to allow per-message rate limiting. When a message contains rate limit definitions, the worker checks these limits before processing. If a limit is exceeded, the message is released back to the queue with a delay until the limit resets.
Add integration tests to verify that task processing is correctly delayed when rate limits are exceeded and that rate-limited tasks from one tenant do not block processing for other tenants.
Include rateLimits in the task configuration objects to allow users to define and enforce concurrency or rate limiting constraints on their tasks.
Introduce the RateLimitConfig schema to define rate-limiting parameters for tasks. Update the task metadata definition to include an optional array of these configurations, enabling granular task throttling support.
Add the rateLimits property to the task type definition to allow users to constrain task execution frequency. This supports both static and dynamic keys, providing granular control over resource usage based on specific task payloads.
Expose the rateLimit property in QueueListPresenter, QueueRetrievePresenter, and TaskPresenter to allow frontend components to access and display queue rate limit configurations.
Add the ability to define and override rate limits for task queues in the dashboard. This includes UI components to manage multiple rate limit rules and backend logic to persist these overrides via the rate limit system.
Implement methods to update and remove queue rate limits in Redis. Add a new key producer method to generate the required Redis key for storing rate limit configurations.
Introduce the RateLimitSystem class to handle overriding and resetting queue rate limits. This service updates the database state and synchronizes the changes with the Redis cache to ensure runtime rate limiting policies are enforced correctly. Include unit tests to verify database interactions and side-effect calls to the queue service.
Initialize the RateLimitSystem as a singleton to ensure a shared instance across the application, preventing redundant database connection handling.
Implement updateQueueRateLimits and removeQueueRateLimits functions to interact with both MARQS and the internal RunQueue engine. These changes allow for dynamic adjustment of rate limiting configurations for specific queues.
Add a test suite to verify that queue concurrency and rate limits can be correctly overridden and removed via the web application interface. This ensures that the queue management actions correctly persist state changes to the database.
Include rate limit configuration in the queue schema to support traffic shaping and request throttling. This allows consumers to define limits and window sizes for queue processing.
Refactor the queue limit override dialog to use a more intuitive layout with Fieldset and InputGroup components. Add support for managing multiple rate limit entries with add/remove functionality and improve input handling for better user experience.
aquiveal
force-pushed
the
feat/add-worker-rate-limiting-support
branch
from
June 8, 2026 04:57
fc07a9f to
09fae6a
Compare
Create a new guide explaining how to implement static and dynamic rate limits for tasks. Include examples for configuring limits per task and per queue, and explain how to manage these settings via the dashboard.
Add a new guide for rate limiting tasks and update the introduction, task overview, and sidebar to include the new functionality. This allows users to control run execution frequency using static or dynamic keys.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes http://feedback.trigger.dev/p/rate-limiting-on-v3
✅ Checklist
Testing
RateLimitManagerto confirm accurate TTL handling and state consistency.Changelog
RateLimitManagerfor atomic, Redis-based traffic shaping to strictly enforce execution windows.RateLimitSystemto manage dynamic configuration and ensure reliable database synchronization.limit,window,staticKey, anddynamicKey).Screenshots