Skip to content

Commit

Permalink
Do refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
YoshiyukiMineo committed Apr 30, 2024
1 parent 917138d commit d5b9529
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions v2/gobreaker.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,10 @@ func (cb *CircuitBreaker[T]) Counts() Counts {
// If a panic occurs in the request, the CircuitBreaker handles it as an error
// and causes the same panic again.
func (cb *CircuitBreaker[T]) Execute(req func() (T, error)) (T, error) {
var zero T

generation, err := cb.beforeRequest()
if err != nil {
return zero, err
var defaultValue T
return defaultValue, err
}

defer func() {
Expand Down

0 comments on commit d5b9529

Please sign in to comment.