Skip to content

feat: add opt-in LIFO dispatch order#458

Merged
pratyush618 merged 4 commits into
masterfrom
feat/s25-lifo-dispatch
Jul 19, 2026
Merged

feat: add opt-in LIFO dispatch order#458
pratyush618 merged 4 commits into
masterfrom
feat/s25-lifo-dispatch

Conversation

@pratyush618

Copy link
Copy Markdown
Collaborator

Summary

Tier 4 overload control S25 — opt-in per-queue LIFO dispatch order, the last of the tier-4 knobs (after S26 max_pending #449 and S27 CoDel #450). fifo (default) runs same-priority jobs oldest-first — the fair ordering a durable queue is expected to keep; lifo runs newest-first, a freshness lever for workloads that would rather run recent work than clear a stale backlog in order under overload. Priority always dominates — this only breaks same-priority ties. Off by default; nothing changes unless a queue opts in.

  • Core: DispatchOrder{Fifo,Lifo} enum + order_for helper; orders: &HashMap<String,DispatchOrder> threaded through dequeue_from/dequeue_batch_from across the trait, diesel_common, SQLite, Postgres, Redis, and the delegate! macro. Diesel flips scheduled_at asc↔desc for LIFO ties (priority stays desc) with an id tie-break for determinism. Scheduler.dispatch_orders map + register_queue_dispatch_order; poller passes it to dequeue.
  • Redis is FIFO-only (documented): its single ZSET score packs priority + scheduled_at, so per-priority LIFO would need a second score-inverted set. lifo is accepted but ignored there, mirroring the list_jobs_after Redis note.
  • Python: set_queue_dispatch_order(queue, order); folded into the _queue_configs wire JSON.
  • Node: QueueLimits.dispatchOrder; wired through config.rs/worker.rs.
  • Java: Taskito.dispatchOrder(queue, order); encodeQueueConfigs now emits CoDel + dispatch order per queue via the late-bound supplier.

Testing

  • cargo test --workspace — 183 core tests (LIFO ties dispatch newest-first, FIFO default oldest-first, priority dominates, id determinism); cargo check default/postgres/redis; clippy --all-targets --all-features + doc -D warnings clean
  • Python: test_dispatch_order + coexistence with test_admission/test_codel — 16 passed; ruff + mypy clean
  • Node: dispatch-order/codel/admission — 12 passed; tsc + biome clean
  • Java: DispatchOrderTest 3 + CodelTest 3 + AdmissionTest 6 — all green

@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 15 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ada93270-38a9-4555-a62e-044247799fd4

📥 Commits

Reviewing files that changed from the base of the PR and between 63b6d74 and 52f2844.

📒 Files selected for processing (24)
  • crates/taskito-core/src/scheduler/mod.rs
  • crates/taskito-core/src/scheduler/poller.rs
  • crates/taskito-core/src/storage/diesel_common/jobs.rs
  • crates/taskito-core/src/storage/mod.rs
  • crates/taskito-core/src/storage/postgres/jobs.rs
  • crates/taskito-core/src/storage/redis_backend/jobs/dequeue.rs
  • crates/taskito-core/src/storage/sqlite/jobs.rs
  • crates/taskito-core/src/storage/sqlite/tests.rs
  • crates/taskito-core/src/storage/traits.rs
  • crates/taskito-core/tests/rust/storage_tests.rs
  • crates/taskito-java/src/convert.rs
  • crates/taskito-java/src/worker.rs
  • crates/taskito-node/src/config.rs
  • crates/taskito-node/src/worker.rs
  • crates/taskito-python/src/py_queue/worker.rs
  • sdks/java/src/main/java/org/byteveda/taskito/DefaultTaskito.java
  • sdks/java/src/main/java/org/byteveda/taskito/Taskito.java
  • sdks/java/src/main/java/org/byteveda/taskito/worker/Worker.java
  • sdks/java/src/test/java/org/byteveda/taskito/core/DispatchOrderTest.java
  • sdks/node/src/types.ts
  • sdks/node/src/worker.ts
  • sdks/node/test/core/dispatch-order.test.ts
  • sdks/python/taskito/mixins/runtime_config.py
  • sdks/python/tests/core/test_dispatch_order.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/s25-lifo-dispatch

Comment @coderabbitai help to get the list of available commands.

@pratyush618
pratyush618 merged commit f66da14 into master Jul 19, 2026
30 checks passed
@pratyush618
pratyush618 deleted the feat/s25-lifo-dispatch branch July 19, 2026 04:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant