Skip to content

Suppress idle-poll heartbeat unless verbose#491

Merged
dereuromark merged 2 commits into
masterfrom
feat/quiet-idle-worker-output
May 6, 2026
Merged

Suppress idle-poll heartbeat unless verbose#491
dereuromark merged 2 commits into
masterfrom
feat/quiet-idle-worker-output

Conversation

@dereuromark
Copy link
Copy Markdown
Owner

Summary

The worker loop in Processor::run() prints three lines every sleeptime() interval whenever the queue is empty:

  • [YYYY-MM-DD HH:MM:SS] Looking for Job ...
  • nothing to do, sleeping.
  • a horizontal-rule separator (---)

On a mostly-idle worker that's continuous steady-state noise: it fills stdout / log files without conveying anything beyond "still alive". The existing verbose flag already gates the structured log('run', …) heartbeat, but not these out() calls.

This PR moves those three lines behind $config['verbose']. Default workers are now silent on empty polls; operators who want the per-iteration heartbeat keep it via -v / --verbose.

What is NOT changed

One-shot events stay always-on because they describe state changes, not steady state:

  • nothing to do, exiting. (when Queue.exitwhennothingtodo is set)
  • Running Job of type "..." / Job Finished.
  • Reached runtime of ... terminating.
  • Performing Old job cleanup.
  • Applying worker lifetime jitter: ...

Background

Spotted while reviewing PR #490, which proposed removing a similar always-on echo "No messages" line from a fork's SQS-polling code path. The literal diff didn't apply upstream (different fork, different layout), but the underlying observation — empty polls shouldn't spam logs — is directly applicable to the upstream worker loop.

Behavior change

For users who relied on the Looking for Job ... / nothing to do, sleeping. output as a liveness signal: pass -v / --verbose (or set the equivalent in your worker invocation). No config or option signatures changed.

The worker loop printed three lines every sleeptime() interval on an
idle queue: a timestamped "Looking for Job ...", "nothing to do,
sleeping.", and a horizontal-rule separator. On a mostly-idle worker
this fills logs and stdout with steady-state noise that conveys no
information beyond "still alive".

Gate those three lines behind the existing verbose flag so the default
worker is silent on empty polls. Operators who want the per-iteration
heartbeat keep it via -v / verbose. One-shot events ("nothing to do,
exiting.", job start/finish, runtime termination, GC sweep) are not
gated since they describe state changes rather than steady state.
@dereuromark dereuromark added this to the 8.x milestone May 6, 2026
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 6, 2026

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

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.62%. Comparing base (b724aaa) to head (4bd5cbe).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #491      +/-   ##
============================================
+ Coverage     77.54%   77.62%   +0.07%     
- Complexity      966      968       +2     
============================================
  Files            45       45              
  Lines          3238     3240       +2     
============================================
+ Hits           2511     2515       +4     
+ Misses          727      725       -2     

☔ 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.

testExecute and testServiceInjection asserted on "Looking for Job",
which is now verbose-only steady-state output. Switch to the always-on
event lines that prove the same thing: "terminating." for the empty-
queue worker loop, and "Running Job of type \"Foo\"" for the
job-execution path.
@dereuromark dereuromark merged commit 6378074 into master May 6, 2026
16 checks passed
@dereuromark dereuromark deleted the feat/quiet-idle-worker-output branch May 6, 2026 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants