Circuit Breaker
Interruptor de circuito
Un disyuntor detiene las llamadas a un servicio remoto que probablemente va a fallar. Más tarde, algunas llamadas de prueba verifican si se recuperó.
closed -> failure threshold -> open -> cool-down -> half-open probe -> closed | open10 segundossin llamada remotaclosed -> failure threshold -> open -> cool-down -> half-open probe -> closed | openSREOtro ejemplo
Cinco fallos de pago abren el disyuntor durante 30 segundos. La comprobación falla rápidamente con un mensaje claro. Una sonda posterior tiene éxito y lo cierra.
Partes principales
- 01Estado cerrado
- 02contador de fallos y ventana
- 03Estado abierto
- 04Tiempo de enfriamiento
- 05Sonda semiabierta
- 06alternativa y alerta
Úsalo cuando
Úsalo alrededor de una dependencia remota que se mantenga lenta o rota. Ajusta el umbral, el tiempo de apertura, el tráfico de prueba, la alternativa y las alertas.
No lo uses cuando
No lo uses para errores de validación local. No reemplaza los reintentos. El reintento maneja fallos breves; un interruptor bloquea fallas probables.
Nombre usado en código
closed -> failure threshold -> open -> cool-down -> half-open probe -> closed | open Antes de lanzarlo
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 Interruptor de circuito (Circuit Breaker). User context: Cinco fallos de pago abren el disyuntor durante 30 segundos. La comprobación falla rápidamente con un mensaje claro. Una sonda posterior tiene éxito y lo cierra. Technical concept or control: Interruptor de circuito (Circuit Breaker). Why it fits: Úsalo alrededor de una dependencia remota que se mantenga lenta o rota. Ajusta el umbral, el tiempo de apertura, el tráfico de prueba, la alternativa y las alertas. Do not use it when: No lo uses para errores de validación local. No reemplaza los reintentos. El reintento maneja fallos breves; un interruptor bloquea fallas probables. 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): Ningún estándar oficial único controla todo el término. Su significado puede cambiar según equipos, plataformas o marcos. 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.
Revisa esta petición
Review how Interruptor de circuito (Circuit Breaker) is used now. Definition: Un disyuntor detiene las llamadas a un servicio remoto que probablemente va a fallar. Más tarde, algunas llamadas de prueba verifican si se recuperó. 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.