Repository navigation
Re-arm the breaker's recovery timer instead of giving up - #18
Merged
Merged
Conversation
Every failure past the threshold pushes the cooldown out to now — and while a breaker is open, failures keep arriving: with all candidates open the gateway fails open and tries them anyway. So the one-shot timer armed when the breaker tripped would wake up, see a cooldown that had been pushed past it, say nothing, and exit. Nothing was left to announce the moment the breaker actually became ready to probe. The visible result is worse than a missing event: the pushed view and the polled view disagree. `/overview` computes the state fresh, so it reports `ok` as soon as the cooldown elapses, while a client following the event stream still shows the provider as tripped — until some request happens to hit it. The timer now re-arms instead of giving up. Health::cooldown_left tells it which of the three cases it woke into: no longer tripped (a success already announced the recovery), cooldown elapsed (announce it), or pushed back (sleep the remainder and look again). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Thanks for the PR. One thing before review: this targets
No need to close and reopen: click Edit next to the PR title and change the base branch to See CONTRIBUTING.md and CONTRIBUTING.md for the branch contract. |
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.
Follow-up to #17, fixing a hole in the recovery half of
HealthChanged.The bug
Every failure past the threshold pushes
opened_atout to now, and failures keep arriving while a breaker is open — with all candidates open the gateway fails open and tries them anyway. The one-shot timer armed when the breaker tripped would wake, see a cooldown that had been pushed past it, say nothing, and exit. Nothing was left to announce the moment the breaker became ready to probe again.The visible result is the two views disagreeing:
/overviewcomputes the state fresh and reportsokas soon as the cooldown elapses, while a client following the event stream still shows the provider as tripped until some request happens to hit it.The fix
The timer re-arms.
Health::cooldown_leftdistinguishes the three cases it can wake into — no longer tripped (a success already announced it), cooldown elapsed (announce), pushed back (sleep the remainder and look again) — replacing the one-shotjust_cooled_down.Gates
cargo fmt --all -- --check,cargo clippy --workspace --all-targets -- -D warnings,cargo test --workspace(61 binaries green),./scripts/smoke.sh(46 passed, 0 failed).🤖 Generated with Claude Code