Skip to content

Add a dead-letter queue and bounded backoff to the webhook dispatcher #317

@greatest0fallt1me

Description

@greatest0fallt1me

Description

src/webhooks/webhook.dispatcher.ts retries deliveries but lacks a terminal dead-letter path for permanently failing endpoints, risking unbounded retry loops. This backend task adds capped exponential backoff and a dead-letter state recorded in src/webhooks/webhook.store.ts so failed deliveries are observable and stop retrying.

Requirements and Context

  • Cap retries with bounded exponential backoff and jitter.
  • Move exhausted deliveries to a dead_letter status with the last error.
  • Expose dead-letter entries for inspection.
  • Must be secure, tested, and documented
  • Should be efficient and easy to review

Suggested Execution

  1. Fork the repo and create a branch
    git checkout -b feature/webhook-dead-letter
  2. Implement changes
    • src/webhooks/webhook.dispatcher.ts — backoff + DLQ transition
    • src/webhooks/webhook.store.ts — persist status/attempts
    • src/webhooks/webhook.types.ts — add dead_letter status
  3. Test and commit
    • npm test -- src/webhooks/webhook.dispatcher.test.ts
    • Cover edge cases
    • Include test output and notes in the PR

Example commit message

feat: add dead-letter queue to webhook dispatcher

Acceptance Criteria

  • Retries stop after the configured cap and enter dead_letter
  • Backoff uses jitter and is bounded
  • Dead-letter entries record the final error

Guidelines

  • Minimum 90% test coverage with Jest
  • Clear documentation and inline comments
  • Timeframe: 96 hours

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave programbackendBackend service workenhancementNew feature or improvementtestingTests and coverage
No fields configured for Feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions