cleanupLoop runs background cleanup of unused circuit breakers
()
| 278 | |
| 279 | // cleanupLoop runs background cleanup of unused circuit breakers |
| 280 | func (cbm *CircuitBreakerManager) cleanupLoop() { |
| 281 | ticker := time.NewTicker(5 * time.Minute) // Cleanup every 5 minutes |
| 282 | defer ticker.Stop() |
| 283 | |
| 284 | for { |
| 285 | select { |
| 286 | case <-ticker.C: |
| 287 | cbm.cleanup() |
| 288 | case <-cbm.cleanupStop: |
| 289 | return |
| 290 | } |
| 291 | } |
| 292 | } |
| 293 | |
| 294 | // cleanup removes circuit breakers that haven't been accessed recently |
| 295 | func (cbm *CircuitBreakerManager) cleanup() { |
no test coverage detected