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

Function newCircuitBreakerManager

maintnotifications/circuit_breaker.go:233–244  ·  view source on GitHub ↗

newCircuitBreakerManager creates a new circuit breaker manager

(config *Config)

Source from the content-addressed store, hash-verified

231
232// newCircuitBreakerManager creates a new circuit breaker manager
233func newCircuitBreakerManager(config *Config) *CircuitBreakerManager {
234 cbm := &CircuitBreakerManager{
235 config: config,
236 cleanupStop: make(chan struct{}),
237 }
238 cbm.lastCleanup.Store(time.Now().Unix())
239
240 // Start background cleanup goroutine
241 go cbm.cleanupLoop()
242
243 return cbm
244}
245
246// GetCircuitBreaker returns the circuit breaker for an endpoint, creating it if necessary
247func (cbm *CircuitBreakerManager) GetCircuitBreaker(endpoint string) *CircuitBreaker {

Callers 2

newHandoffWorkerManagerFunction · 0.85

Calls 1

cleanupLoopMethod · 0.95

Tested by 1