ReviewPilot

14 PRs revisados hoje · 32 achados · 8 críticos evitados antes do merge

PRs na semana

63

+12% vs anterior

Achados críticos

8

19 avisos · 5 sugestões

Tempo médio

2m 41s

por review

Taxa de aprovação

71%

sem retrabalho

Fila de revisão

Achados por categoria

  • Segurança11
  • Performance8
  • Bug9
  • Estilo4

feat: retry na fila de webhooks

toolzz/api-core · feat/webhook-retry · src/queue/webhook-dispatcher.ts

Veredito: Atenção
  1. 4141 export async function dispatchWebhook(event: WebhookEvent) {
  2. 42- await fetch(event.url, { method: 'POST', body: JSON.stringify(event.payload) });
  3. 42+ const maxRetries = 5;
  4. 43+ for (let attempt = 0; attempt <= maxRetries; attempt++) {
    CríticoRetry sem backoff exponencial

    Delay fixo de 1s com 5 tentativas pode derrubar o endpoint de destino em cascata. Use backoff exponencial com jitter (ex.: 2^attempt * 500ms).

  5. 44+ const res = await fetch(event.url, {
  6. 45+ method: 'POST',
  7. 46+ body: JSON.stringify(event.payload),
  8. 47+ });
    AvisoFalta header Content-Type

    O fetch envia JSON sem 'Content-Type: application/json'. Receptores estritos vão rejeitar com 415.

  9. 48+ if (res.ok) return;
    SugestãoRegistrar tentativa falha

    Considere logar status e attempt quando res.ok for falso, para facilitar debug de entregas perdidas.

  10. 49+ await sleep(1000);
  11. 50+ }
  12. 4351 }
Made with Vibe