Implementing a circuit breaker