Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom checker for half-open state like ReadyToTrip #28

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update readme
  • Loading branch information
Evgeniy Belousov committed Feb 28, 2020
commit 4f079cb62cb32cd5edf7537b2ff9f28464d75fc5
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ You can configure `CircuitBreaker` by the struct `Settings`:
```go
type Settings struct {
Name string
MaxRequests uint32
ReadyToClose func(counts Counts) (bool, bool)
Interval time.Duration
Timeout time.Duration
ReadyToTrip func(counts Counts) bool
Expand All @@ -39,9 +39,11 @@ type Settings struct {

- `Name` is the name of the `CircuitBreaker`.

- `MaxRequests` is the maximum number of requests allowed to pass through
when the `CircuitBreaker` is half-open.
If `MaxRequests` is 0, `CircuitBreaker` allows only 1 request.
- `ReadyToClose` is called with a copy of `Counts` for each request in the half-open state.
If `ReadyToClose` returns true, the `CircuitBreaker` will be placed into the close state.
If `ReadyToClose` returns false, the `CircuitBreaker` will be placed into the open state if second returned value is true.
If `ReadyToClose` is nil, default `ReadyToClose` is used.
Default `ReadyToClose` returns true when the number of consecutive successes is more than 1.

- `Interval` is the cyclic period of the closed state
for `CircuitBreaker` to clear the internal `Counts`, described later in this section.
Expand Down