Course contentsShow
← System Design
Lesson 1052 of 1,91927. Circuit Breakers and BulkheadsFree lesson

Circuit Breaker Reset Logic

Understanding how successful requests in Half-Open state trigger circuit closure and what happens on continued failures.

Circuit Breaker Reset Logic

You'll learn how a circuit breaker decides to fully close after being Half-Open, and what happens when recovery attempts fail.

How the Half-Open State Resolves

When a circuit breaker enters the Half-Open state, it cautiously allows a limited number of test requests through. This is where reset logic determines the system's next move:

Success Path: Closing the Circuit

If these test requests succeed (meeting whatever success criteria you've defined—usually response within timeout with valid status codes), the circuit breaker interprets this as "the downstream service has recovered." After a configured number of consecutive successes (often just 1–3), the circuit breaker transitions back to Closed state, resuming normal traffic flow.

Think of it like checking if a tripped electrical breaker can handle load again. You flip it halfway, plug in one appliance. If it works, you flip it fully on.

Failure Path: Re-Opening

If test requests in Half-Open state fail (timeout, error response, or exception), the circuit breaker immediately snaps back to Open state. The failure threshold is typically very sensitive here—sometimes a single failure is enough. The system starts a new waiting period before attempting Half-Open again.

This prevents repeatedly hammering a struggling service. One failed probe tells you "not yet recovered."

Configuration Matters

Reset logic depends on:

  • Success threshold: How many consecutive successes trigger closure (e.g., 2 out of 2 requests)
  • Failure sensitivity: How many failures re-open (often 1)
  • Sample size: How many requests to allow through Half-Open (small, like 5–10)

Key Takeaway:
Circuit breaker reset logic uses successful requests in Half-Open state to confidently close the circuit, while any continued failure immediately re-opens it, protecting your system from premature reconnection to unhealthy dependencies.