shouldAttemptReset checks if enough time has passed to attempt reset
()
| 86 | |
| 87 | // shouldAttemptReset checks if enough time has passed to attempt reset |
| 88 | func (cb *CircuitBreaker) shouldAttemptReset() bool { |
| 89 | lastFailure := time.Unix(cb.lastFailureTime.Load(), 0) |
| 90 | return time.Since(lastFailure) >= cb.resetTimeout |
| 91 | } |
| 92 | |
| 93 | // Execute runs the given function with circuit breaker protection |
| 94 | func (cb *CircuitBreaker) Execute(fn func() error) error { |