Repository navigation
fix: reload worker after exactly maxJobs requests, not one later - #1108
Merged
Merged
Conversation
This was referenced Oct 29, 2026
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.
Closes #967
Problem
MaxJobsRebootStrategy::shouldReboot()used++$this->jobsCount > $this->maxJobs. Since the strategy is consulted after each request is handled (HttpRequestHandler, after terminate/close), a worker servedmaxJobs + 1requests before reloading — confirmed by the maintainer's repro in the issue (requests: 2served 3 requests per worker). The docs already say the worker reloads after N requests.Fix
shouldReboot()now uses>=, so the Nth request triggers the reload. No doc change was needed:docs/reload-strategies.md("reloads after aboutrequestsrequests"),docs/configuration.mdand theConfigurationTreeBuilderinfo text already describe the N-request behaviour ("about" covers the dispersion range).Tests
testMaxJobsRebootStrategyReturnsFalseUntilLimit(maxJobs 3): now false, false, true — the 3rd request triggers the reload.testMaxJobsRebootStrategyWithZeroDispersion(maxJobs 5): reboot point corrected from 6 to 5, matching its own assertion message.testMaxJobsRebootStrategyWithSeededRandomizer: drawn limit 90 now reboots at the 90th call, not the 91st.Note: this environment has no PHP runtime, so the PHPUnit suite could not be run here — the change is a one-operator fix plus test-expectation updates, and CI's test job is the verification step. Please let me know if CI flags anything.