Repository navigation
feat(breaker): add a shared circuit breaker and retry with jitter - #373
Merged
Merged
Conversation
The breaker package's Health example uses lifecycle.WithDegraded, which v0.1.0 does not have. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Package breaker is connect-control's consecutive-failure breaker (closed, open, half-open with a single trial, injectable clock, IsFailure and OnStateChange), moved with its tests unchanged, plus Retry: exponential backoff with a cap, full jitter by default, a caller-supplied retryable classifier, a context-carried logger and prompt stop on cancellation. Breaker.Health fits lifecycle.CheckFunc without the package importing lifecycle. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
patdowney
force-pushed
the
feat/breaker
branch
from
November 15, 2026 23:10
12d4788 to
985c626
Compare
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 #368.
Changes
New package
breaker:IsFailure,OnStateChange,Health,ErrOpen). Extra tests coverIsFailure, the transition sequence, one trial under concurrency andState.String.Retry(ctx, RetryConfig, fn): capped exponential backoff, full jitter by default (NoJitterto disable), caller-suppliedRetryable(default skipsErrOpenand cancellation), logger fromzerolog.Ctx(ctx), stops promptly on cancellation.Healthas alifecycledegraded check; the package itself does not importlifecycle.Testing
go test -race ./...,golangci-lintandgosecpass.Consumers need a release of
dioad/netfirst; each adopter should delete its local copy in the same change.🤖 Generated with Claude Code