Skip to content

fix: exit a draining worker as soon as no slot is busy - #4

Merged
webpatser merged 1 commit into
mainfrom
fix/drain-exit-when-idle
Aug 30, 2026
Merged

webpatser merged 1 commit into
mainfrom
fix/drain-exit-when-idle

Conversation

@webpatser

Copy link
Copy Markdown
Owner

Summary

  • After max_jobs_per_worker / max_worker_lifetime / stop signal the reader Fibers stop polling, but the hard-exit timer still slept out drain_grace_seconds with every slot idle.
  • On scrpr (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 80k scrpr lag until a supervisor restart.
  • The timer now exits immediately when drainComplete($slotStarts) (no job in flight); the grace window only applies while a job is actually running.

Test plan

  • tests/Unit/Worker/WorkerDrainCompleteTest.php
  • full suite green

🤖 Generated with Claude Code

https://claude.ai/code/session_014vbDzqsY85c7hEPRSxM3XK

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.
@webpatser
webpatser merged commit c287f2c into main Aug 30, 2026
1 check passed
@webpatser
webpatser deleted the fix/drain-exit-when-idle branch August 30, 2026 06:32
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