Circuit Breaker
The payment dependency keeps timing out. Stop making every request wait, fail fast or degrade, and probe it again after a pause.
The payment dependency keeps timing out. Stop making every request wait, fail fast or degrade, and probe it again after a pause.
Requests pass while the dependency is healthy.
Problem and key mechanism: Repeated dependency timeouts or failures accumulate waiting and resource use at the caller; after crossing the threshold, the circuit breaker moves from Closed to Open for fast failure or fallback, then allows only a small probe in Half-Open after a pause.
Feedback decides recovery: A successful probe returns to Closed; a failed probe opens the circuit again. The caller is protected, but the breaker does not repair or guarantee the dependency.
A second scenario: weather lookup: A trip page depends on an external weather API. After repeated failures, it can temporarily return a cached forecast with its update time and stop calling the dependency, then use a few probes before restoring normal lookup.
Add a circuit breaker around the payment dependency: stay Closed normally, enter Open after repeated failures with fast failure or a clear fallback, then move to Half-Open for a small recovery probe. Return to Closed only after success. Simulate timeouts and recovery, and verify the state, user feedback, and probe are observable.