Skip to content

Add --force flag to queue worker clean#492

Merged
dereuromark merged 1 commit into
masterfrom
feature/worker-clean-force
May 8, 2026
Merged

Add --force flag to queue worker clean#492
dereuromark merged 1 commit into
masterfrom
feature/worker-clean-force

Conversation

@dereuromark
Copy link
Copy Markdown
Owner

Summary

  • Adds --force (-f) option to bin/cake queue worker clean
  • Forces deletion of ALL queue_processes rows, bypassing the heartbeat-based threshold
  • Use case: container restarts where PIDs are reused. The killed worker's row survives with a recent modified timestamp, so the heartbeat-based cleanup won't remove it, and the unique (pid, server) index makes the new worker crash-loop.

Why a flag (not auto-recovery)

This is the operator escape hatch — minimal change, opt-in, no behavioral surprise. A follow-up PR will add automatic eviction in add() for the common case so this flag becomes rarely needed.

When a containerized worker is killed (SIGKILL, container restart) the
queue_processes row survives with a recent modified timestamp. The default
heartbeat-based cleanEndedProcesses() considers the row "still alive" and
keeps it. The new worker, getting the same recycled PID, then crash-loops
on the unique (pid, server) index.

The --force flag wipes every queue_processes row in one shot so an operator
can recover without manual SQL.
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 8, 2026

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 55.55556% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.51%. Comparing base (6378074) to head (8a5735e).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/Command/WorkerCommand.php 46.66% 8 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #492      +/-   ##
============================================
- Coverage     77.62%   77.51%   -0.12%     
- Complexity      968      971       +3     
============================================
  Files            45       45              
  Lines          3240     3255      +15     
============================================
+ Hits           2515     2523       +8     
- Misses          725      732       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dereuromark dereuromark merged commit 1f88ba5 into master May 8, 2026
16 checks passed
@dereuromark dereuromark deleted the feature/worker-clean-force branch May 8, 2026 14:50
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.

2 participants