MCPcopy
hub / github.com/redis/go-redis / shouldAttemptReset

Method shouldAttemptReset

maintnotifications/circuit_breaker.go:88–91  ·  view source on GitHub ↗

shouldAttemptReset checks if enough time has passed to attempt reset

()

Source from the content-addressed store, hash-verified

86
87// shouldAttemptReset checks if enough time has passed to attempt reset
88func (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
94func (cb *CircuitBreaker) Execute(fn func() error) error {

Callers 1

ExecuteMethod · 0.95

Calls 1

LoadMethod · 0.45

Tested by

no test coverage detected