check_circuit_breaker

Function check_circuit_breaker 

Source
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, Err with cached error if circuit is open

§Errors

  • Returns Err if 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 OpenHalfOpen after cooldown period.