fix: exit a draining worker as soon as no slot is busy - #4
Merged
Merged
Conversation
After limits are reached the reader Fibers stop polling, yet the hard-exit timer waited the full drain_grace_seconds even with every slot idle. With a grace sized for long jobs that parked each rotated worker, and a draining master behind a deploy, for the whole window.
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
max_jobs_per_worker/max_worker_lifetime/ stop signal the reader Fibers stop polling, but the hard-exit timer still slept outdrain_grace_secondswith every slot idle.TORQUE_DRAIN_GRACE=7200) every rotation parked the worker, and the draining master behind each deploy, for two hours; the fleet showed 10,000 jobs processed, 0/4 slots, throughput 0 and an 80kscrprlag until a supervisor restart.drainComplete($slotStarts)(no job in flight); the grace window only applies while a job is actually running.Test plan
tests/Unit/Worker/WorkerDrainCompleteTest.php🤖 Generated with Claude Code
https://claude.ai/code/session_014vbDzqsY85c7hEPRSxM3XK