Skip to content

feat(backend): implement resilient webhook delivery queue with retries - #1139

Merged
Akanimoh12 merged 2 commits into
Akanimoh12:test-implement-dripsfrom
AbuJulaybeeb:feature/webhook-delivery-queue
Jul 28, 2026
Merged

feat(backend): implement resilient webhook delivery queue with retries#1139
Akanimoh12 merged 2 commits into
Akanimoh12:test-implement-dripsfrom
AbuJulaybeeb:feature/webhook-delivery-queue

Conversation

@AbuJulaybeeb

Copy link
Copy Markdown
Contributor

closes #993

Problem

The backend requires a resilient mechanism to reliably deliver webhooks to off-chain clients with support for retries and backoff when transient network failures or downtime occur.

Solution

This PR implements a dedicated BullMQ job queue (webhook-delivery) backed by the shared Redis instance. It includes an autonomous worker that handles HTTP POST dispatching with automated backoff/retry policies and HMAC request signing.

Key Changes:

  • Queue Initialization: Created src/jobs/webhookDelivery.ts to manage the webhook-delivery queue, automatically retrying failed jobs up to 5 times with exponential backoff.
  • Worker Logic: The worker performs native fetch requests with a 10-second AbortController timeout. Non-2xx responses correctly throw errors to natively leverage BullMQ's automatic backoff mechanics.
  • HMAC Security: Supports appending an X-Signature header via HMAC SHA256 when a payload secret is provided.
  • Tests: Added comprehensive Vitest unit tests in tests/jobs/webhookDelivery.test.ts to verify successful delivery, secure signing, and failure behaviors using global fetch mocking.

Verification

  • Jobs are idempotent (only storing URL and JSON payloads).
  • Typecheck passes (npm run typecheck).
  • Lint passes (npm run lint).
  • Tests pass (npm run test).

- Initialized `webhook-delivery` BullMQ queue in `src/jobs/webhookDelivery.ts`.
- Built a Worker to execute POST requests via native `fetch` with 10s timeout.
- Added HMAC SHA256 signing for payload security.
- Included robust unit tests mocking fetch to verify retries and backoff.
@drips-wave

drips-wave Bot commented Jul 28, 2026

Copy link
Copy Markdown

@AbuJulaybeeb Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Akanimoh12
Akanimoh12 merged commit 096a89d into Akanimoh12:test-implement-drips Jul 28, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Jobs: Job: webhook delivery + retries

2 participants