Circuit Breaker
Disjuntor (Circuit Breaker)
Um disjuntor interrompe chamadas para um serviço remoto que provavelmente falhará. Mais tarde, algumas chamadas de teste verificam se ele se recuperou.
closed -> failure threshold -> open -> cool-down -> half-open probe -> closed | open10 segundosnenhuma chamada remotaclosed -> failure threshold -> open -> cool-down -> half-open probe -> closed | openSREOutro exemplo
Cinco falhas de pagamento abrem o disjuntor por 30 segundos. O checkout falha rapidamente com uma mensagem clara. Uma sondagem posterior tem sucesso e o fecha.
Partes principais
- 01Estado fechado
- 02contador de falhas e janela
- 03Estado aberto
- 04Tempo de resfriamento
- 05Sonda semiaberta
- 06fallback e alerta
Use-o quando
Use-o ao redor de uma dependência remota que permanece lenta ou quebrada. Ajuste o limiar, o tempo de abertura, o tráfego de teste, o fallback e os alertas.
Não o use quando
Não o use para erros de validação local. Ele não substitui tentativas. Tentativas lidam com falhas breves; um disjuntor bloqueia falhas prováveis.
Nome usado no código
closed -> failure threshold -> open -> cool-down -> half-open probe -> closed | open Antes de lançar
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 Disjuntor (Circuit Breaker) (Circuit Breaker). User context: Cinco falhas de pagamento abrem o disjuntor por 30 segundos. O checkout falha rapidamente com uma mensagem clara. Uma sondagem posterior tem sucesso e o fecha. Technical concept or control: Disjuntor (Circuit Breaker) (Circuit Breaker). Why it fits: Use-o ao redor de uma dependência remota que permanece lenta ou quebrada. Ajuste o limiar, o tempo de abertura, o tráfego de teste, o fallback e os alertas. Do not use it when: Não o use para erros de validação local. Ele não substitui tentativas. Tentativas lidam com falhas breves; um disjuntor bloqueia falhas prováveis. 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): Nenhum padrão oficial único controla todo o termo. Seu significado pode mudar entre equipes, plataformas ou frameworks. 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.
Conferir este pedido
Review how Disjuntor (Circuit Breaker) (Circuit Breaker) is used now. Definition: Um disjuntor interrompe chamadas para um serviço remoto que provavelmente falhará. Mais tarde, algumas chamadas de teste verificam se ele se recuperou. 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.