newCircuitBreakerManager creates a new circuit breaker manager
(config *Config)
| 231 | |
| 232 | // newCircuitBreakerManager creates a new circuit breaker manager |
| 233 | func 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 |
| 247 | func (cbm *CircuitBreakerManager) GetCircuitBreaker(endpoint string) *CircuitBreaker { |