pub fn check_circuit_breaker(
endpoint_pattern: &str,
) -> Result<(), Box<dyn Error + Send + Sync>>Expand description
What: Check circuit breaker state before making a request.
Inputs:
endpoint_pattern: Endpoint pattern to check circuit breaker for
Output:
Ok(())if request should proceed,Errwith cached error if circuit is open
§Errors
- Returns
Errif the circuit breaker is open and cooldown period has not expired.
Details:
- Returns error immediately if circuit is Open and cooldown not expired.
- Allows request if circuit is Closed or
HalfOpen. - Automatically transitions
Open→HalfOpenafter cooldown period.