Conversation
|
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughA new boolean field Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes 🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@cubic-dev-ai please review |
@ericallam I have started the AI code review. It will take a few minutes to complete. |
Summary
Currently, every triggered run follows a two-step path through Redis:
processQueueForWorkerQueuejob fires ~500ms later, checks concurrency limits, removes the message from the sorted set, and pushes it to a worker queue (Redis list) where workers pick it up viaBLPOPThis means every run pays at least ~500ms of latency between being triggered and being available for a worker to execute, even when the queue is empty and concurrency is wide open.
What changed
The enqueue Lua scripts now atomically decide whether to skip the queue sorted set entirely and push directly to the worker queue. This happens inside the same Lua script that handles normal enqueue, so the decision is atomic with respect to concurrency bookkeeping.
A run takes the fast path when all of these are true:
WorkerInstanceGroup)ZRANGEBYSCOREfinds nothing with score ≤ now) — this respects priority ordering and allows fast path even when the queue has future-scored messages (e.g. nacked retries with delay)When the fast path is taken:
RPUSH)SADDto the same sets used by the normal dequeue path)processQueueForWorkerQueuejob is not scheduled (no work to do)expireRunworker job handles TTL independently)When any condition fails, the existing slow path runs unchanged.
Rollout gating
enableFastPathboolean onWorkerInstanceGroup(defaults tofalse), allowing region-by-region rolloutRolling deploy safety
Each process registers its own Lua scripts via
defineCommand(identified by SHA hash). Old and new processes never share scripts. The Redis data structures are fully compatible in both directions — ack, nack, and release operations work identically regardless of which path a message took.Test plan
enableFastPathis false