Circuit Breaker
Interruttore automatico (Circuit Breaker)
Un interruttore automatico interrompe le chiamate a un servizio remoto che probabilmente fallirà. Successivamente, alcune chiamate di test verificano se si è ripreso.
closed -> failure threshold -> open -> cool-down -> half-open probe -> closed | open10 secondinessuna chiamata remotaclosed -> failure threshold -> open -> cool-down -> half-open probe -> closed | openSREUn altro esempio
Cinque fallimenti di pagamento aprono l'interruttore per 30 secondi. Il checkout fallisce rapidamente con un messaggio chiaro. Una successiva verifica riesce e lo chiude.
Parti principali
- 01Stato chiuso
- 02Contatore di guasti e finestra
- 03Stato aperto
- 04Tempo di raffreddamento
- 05Sonda semi-aperta
- 06Ripiego e avviso
Usalo quando
Usalo intorno a una dipendenza remota che rimane lenta o non funzionante. Regola la soglia, il tempo di apertura, il traffico di test, la soluzione alternativa e gli avvisi.
Non usarlo quando
Non usarlo per errori di convalida locali. Non sostituisce i tentativi. Il retry gestisce brevi errori; un breaker blocca probabili fallimenti.
Nome usato nel codice
closed -> failure threshold -> open -> cool-down -> half-open probe -> closed | open Prima di spedire
Check contracts and invariants, authorization, and input limits. Test retries, one-time effects, timeouts, and partial failures. Verify data integrity, compatibility, monitoring, recovery, and rollback.
Outcome: Complete the task with Interruttore automatico (Circuit Breaker) (Circuit Breaker). User context: Cinque fallimenti di pagamento aprono l'interruttore per 30 secondi. Il checkout fallisce rapidamente con un messaggio chiaro. Una successiva verifica riesce e lo chiude. Technical concept or control: Interruttore automatico (Circuit Breaker) (Circuit Breaker). Why it fits: Usalo intorno a una dipendenza remota che rimane lenta o non funzionante. Regola la soglia, il tempo di apertura, il traffico di test, la soluzione alternativa e gli avvisi. Do not use it when: Non usarlo per errori di convalida locali. Non sostituisce i tentativi. Il retry gestisce brevi errori; un breaker blocca probabili fallimenti. Engineering requirements: Define inputs, outputs, contracts, and rules that must always hold. Set authorization and input checks. Define failures, timeouts, retries, one-time effects, data moves, and compatibility limits. Operations: Add useful signals and logs that hide sensitive data. Set capacity limits and write an operator guide. Test recovery and rollback. Acceptance criteria: Contract and failure-path tests pass. Data and authorization rules still hold during retries and partial failures. Check performance limits, monitoring, recovery, and rollback. Evidence and limits (evidence boundary): Nessun singolo standard ufficiale controlla l'intero termine. Il suo significato può cambiare tra team, piattaforme o framework. Unknowns to confirm: Where the code runs, data stores, traffic shape, consistency needs, and the security boundary. Also confirm the compatibility period, service goals, and rollback limits.
Controlla questa richiesta
Review how Interruttore automatico (Circuit Breaker) (Circuit Breaker) is used now. Definition: Un interruttore automatico interrompe le chiamate a un servizio remoto che probabilmente fallirà. Successivamente, alcune chiamate di test verificano se si è ripreso. Release checks: Check contracts and invariants, authorization, and input limits. Test retries, one-time effects, timeouts, and partial failures. Verify data integrity, compatibility, monitoring, recovery, and rollback. Before changing code, list the evidence, gaps, severity, and the smallest safe fix.