Collector idle backoff fixes - #453
Merged
Merged
Conversation
…ooping The main collector loop only slept when $count was 0, but $count is incremented unconditionally for every active job (once for existing, once more for not being done yet). As a result the loop never slept while at least one test was running, polling job dir files as fast as possible and pinning a full CPU core for the duration of the run, regardless of concurrency settings. Track actually-processed work (runner output lines, queue tasks, job events) separately from the liveness counter that guards loop exit. When an iteration processes nothing, usleep with exponential backoff starting at 1ms and doubling up to a 100ms cap; any activity resets the backoff to 1ms. Note: the collector's wait_time attribute (default 0.02s, not exposed as a CLI option and never set from within the dist) is no longer read by this loop. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MdHUTVs9jHn34nXGyjyXXp
- Use wait_time as the backoff ceiling, default 0.02, with a 1ms floor, so worst case event latency matches what it was before the backoff. - Reset the backoff on every path that did work, including the one that skips the job loop. - Count newly discovered jobs as work. - Move the backoff into reset_idle_wait() and idle_sleep(). - Use Time::HiRes::sleep rather than usleep, per the style guide. - Add t/unit/Test2/Harness/Collector.t; the module had no unit test. - Shorten the Changes entry to one sentence. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
No description provided.