Skip to content

Add priority column to background_job table#42

Merged
Theauxm merged 1 commit intomainfrom
fix/background-job-priority
Mar 23, 2026
Merged

Add priority column to background_job table#42
Theauxm merged 1 commit intomainfrom
fix/background-job-priority

Conversation

@Theauxm
Copy link
Copy Markdown
Member

@Theauxm Theauxm commented Mar 23, 2026

Summary

  • Adds priority integer column (default 0) to trax.background_job so workers can dequeue high-priority jobs first
  • Adds SQL migration (031) with a partial index on unfetched rows ordered by priority DESC, created_at ASC
  • Updates BackgroundJob model and CreateBackgroundJob DTO to include the new field

Context

Part of a cross-repo fix for worker priority inversion. Priority flows from WorkQueue entries through the dispatcher into background_job rows, where LocalWorkerService (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 warnings
  • dotnet test in Trax.Effect — all 347 tests pass
  • ./pack-local.sh — downstream Trax.Scheduler tests depend on this package
  • Verify migration applies cleanly on a fresh database (docker compose down -v && docker compose up -d)

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.
@Theauxm Theauxm merged commit d6bb887 into main Mar 23, 2026
1 check passed
@Theauxm Theauxm deleted the fix/background-job-priority branch March 23, 2026 21:02
@traxsharp
Copy link
Copy Markdown

traxsharp Bot commented Mar 23, 2026

This PR is included in version 1.26.0

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