fix: move rate limited queue items off the main queue#2155
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a queue blocking issue with rate-limited items by moving them to a separate table instead of maintaining their position in the main queue. This prevents rate-limited items from blocking the head of the queue and causing scheduling timeouts for non-rate-limited items.
- Creates a new
v1_rate_limited_qistable to store rate-limited queue items separately - Adds logic to move rate-limited items with requeue times > 2 seconds to the separate table
- Fixes package naming inconsistency from
v2tov1in scheduler components
Reviewed Changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| sql/schema/v1-core.sql | Adds new v1_rate_limited_qis table schema |
| cmd/hatchet-migrate/migrate/migrations/20250817183956_v1_0_37.sql | Migration script for the new table |
| pkg/scheduling/v1/*.go | Corrects package name from v2 to v1 across all scheduler files |
| pkg/repository/v1/sqlcv1/queue.sql* | Adds SQL queries for moving and requeuing rate-limited items |
| pkg/repository/v1/scheduler_queue.go | Implements logic to move rate-limited items to separate table |
| pkg/repository/v1/scheduler_rate_limit.go | Updates rate limit repository return type |
| internal/services/ingestor/ingestor_v1.go | Passes context through function calls |
| internal/services/controllers/v1/task/controller.go | Adds telemetry spans |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
mrkaye97
approved these changes
Aug 17, 2025
Contributor
mrkaye97
left a comment
There was a problem hiding this comment.
looks great, nice idea!
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.
Description
Currently, items in a queue which are being rate-limited maintain their position in the queue. This means that in cases with heavy use of dynamic rate limits, the head of the queue gets blocked (up to the
SERVER_SINGLE_QUEUE_LIMIT, which I believe is 100 by default). This results in many scheduling timeouts, even for items which are not necessarily being rate limited. While this behavior was intended with the v1 refactor, it's undocumented and unexpected thus resembles a bug.Some other drive-by fixes:
package v2in the v1 schedulerType of change