Skip to content

Add webhook retry delay helper with exponential backoff and structured error logging on exhaustion #597

Description

@Chucks1093

Summary

Webhook retries compute their delay inline and emit no structured log when all attempts are exhausted. A shared delay helper and a dedicated exhaustion log together make the retry system both consistent and observable.

Scope

  • Add computeRetryDelay(attempt: number, baseMs: number, maxMs: number): number — delay doubles per attempt up to maxMs, plus random jitter up to 20% of the computed delay; add unit tests for attempt 0, 1, 2, and maxMs capping
  • Emit a structured error log on retry exhaustion with fields: webhook_id, creator_id, event_type, total_attempts, last_error_code, flagged_at; callback URL must be absent from the log
  • The exhaustion log emits once per exhaustion event — not on each individual retry failure
  • Replace all inline delay calculations with the new helper

Acceptance Criteria

  • Helper doubles delay per attempt and caps at maxMs
  • Jitter within 20% applied correctly
  • Unit tests pass for attempt 0, 1, 2, and cap scenario
  • Exhaustion log emitted exactly once with all six fields
  • Callback URL absent from exhaustion log
  • Inline delay calculations removed

ETA: 12 hours


Coordinate on Telegram

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions