Repository navigation
Conversation
This branch has not been deployed
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.
Fixes #390.
After a time-based circuit breaker has been idle for longer than its window,
getCurrentBucket()resets the buckets but returns the previously current bucket. The first new execution is recorded into that stale bucket instead of bucket zero. A subsequent rotation can remove that execution before its new window expires; two failures that should meet the threshold can leave the circuit closed.The same path also exposes a timestamp problem:
reset()initializes the remaining buckets with future start times, but rotation adds an entire window to those times. Results can then remain counted beyond their window. Rotation now derives each bucket's start time from the preceding bucket, and the full-reset path returns the new current bucket.Regression coverage uses the existing fake clock, with no sleeps:
Validation on Temurin Java 8:
mvn -pl core -Dtest=TimedCircuitStatsTest,ClosedStateTest -DforkCount=0 test: 19 tests passed.mvn -DforkCount=0 test: all 333 tests passed (315 core, 9 OkHttp, 9 Retrofit), with no failures, errors, or skips.git diff --checkpassed.The local Windows Surefire launcher stalled when spawning a separate JVM, so these runs used
-DforkCount=0. No build configuration was changed; the upstream Java 8/11/17 CI matrix remains applicable.