Retry Policy and Exponential Backoff
Política de Repetição e Retardo Exponencial
Uma política de repetição decide quais trabalhos falhos podem tentar novamente. O backoff adiciona uma espera maior após cada falha.
Outro exemplo
Um serviço recebe um erro 503. Ele espera cerca de 1 segundo antes da tentativa 2 e cerca de 2 segundos antes da tentativa 3. A terceira tentativa funciona.
Partes principais
- 01Erro que pode ser repetido
- 02Número de tentativa
- 03Atraso crescente
- 04Jitter
- 05Parar orçamento
Use-o quando
Use-o para falhas curtas de rede ou serviço quando repetir o trabalho for seguro.
Não o use quando
Não tente novamente uma entrada incorreta ou acesso negado. Para um pagamento, use primeiro uma chave que impeça que a mesma cobrança seja executada duas vezes.
Nome usado no código
retryable error + delay * 2 + jitter + attempt budget 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 Política de Repetição e Retardo Exponencial (Retry Policy and Exponential Backoff). User context: Um serviço recebe um erro 503. Ele espera cerca de 1 segundo antes da tentativa 2 e cerca de 2 segundos antes da tentativa 3. A terceira tentativa funciona. Technical concept or control: Política de Repetição e Retardo Exponencial (Retry Policy and Exponential Backoff). Why it fits: Use-o para falhas curtas de rede ou serviço quando repetir o trabalho for seguro. Do not use it when: Não tente novamente uma entrada incorreta ou acesso negado. Para um pagamento, use primeiro uma chave que impeça que a mesma cobrança seja executada duas vezes. 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 Política de Repetição e Retardo Exponencial (Retry Policy and Exponential Backoff) is used now. Definition: Uma política de repetição decide quais trabalhos falhos podem tentar novamente. O backoff adiciona uma espera maior após cada falha. 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.