-
Notifications
You must be signed in to change notification settings - Fork 187
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
Where's the option for fallback function? #22
Comments
Which fallback function are you referring to? Do you mean callback functions? https://github.com/sony/gobreaker/blob/master/gobreaker.go#L106-L107 |
Hi, @YoshiyukiMineo , |
I didn't see fallback specifically in the example, but mySuccessReturn, err := cb.Execute(func() (interface{}, error) {
// do stuff
})
if err != nil {
if errors.Is(err, gobreaker.ErrOpenState) {
// circuit is open
// this is where a fallback option happens
} else { // this will be the returned error from "do stuff"
}
} |
@timjonesdev what you suggested to implement the circuit breaker default fallback is good as it's true. However, if there's a default function passed with the setting struct it will be more easy to point, simple to change without touch the actual implementation, and descriptive for each service. Its an opinion at the end. |
@ahmedashraff hello, i think we can customize trigger conditions by replacing
|
No description provided.
The text was updated successfully, but these errors were encountered: