Suppress idle-poll heartbeat unless verbose#491
Merged
Conversation
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.
|
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
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.
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
The worker loop in
Processor::run()prints three lines everysleeptime()interval whenever the queue is empty:[YYYY-MM-DD HH:MM:SS] Looking for Job ...nothing to do, sleeping.---)On a mostly-idle worker that's continuous steady-state noise: it fills stdout / log files without conveying anything beyond "still alive". The existing
verboseflag already gates the structuredlog('run', …)heartbeat, but not theseout()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.(whenQueue.exitwhennothingtodois 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.