Add priority column to background_job table#42
Merged
Conversation
Workers now dequeue by priority DESC, created_at ASC instead of pure FIFO. The priority value flows from WorkQueue entries through the dispatcher into the background_job row so LocalWorkerService respects dispatch priority when claiming jobs. Adds a migration that creates the column with a partial index on unfetched rows ordered by priority.
|
This PR is included in version 1.26.0 |
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.
Summary
priorityinteger column (default 0) totrax.background_jobso workers can dequeue high-priority jobs firstpriority DESC, created_at ASCBackgroundJobmodel andCreateBackgroundJobDTO to include the new fieldContext
Part of a cross-repo fix for worker priority inversion. Priority flows from
WorkQueueentries through the dispatcher intobackground_jobrows, whereLocalWorkerService(in Trax.Scheduler) now dequeues by priority instead of pure FIFO.Companion PRs: Trax.Scheduler (code + tests), Trax.Docs (documentation)
Test plan
dotnet build— zero warningsdotnet testin Trax.Effect — all 347 tests pass./pack-local.sh— downstream Trax.Scheduler tests depend on this packagedocker compose down -v && docker compose up -d)