Book a demo
Engineering · 2026-11-12 · 9 min read

Ten thousand webhooks a minute, without a queue of lies

A queue that acknowledges before it persists is not a queue, it is a promise you cannot keep. We learned this the expensive way in March, and the fix reshaped how our ingest path works.

The failure

A provider sent us 340 refund events for the same order over about forty minutes. Our endpoint returned 200 immediately and pushed the payload onto an in-memory channel. When the worker pool fell behind, the channel filled, and we started dropping — silently, because the drop happened after the acknowledgement.

From the provider's side everything succeeded. From ours, 340 events arrived and 61 workflows ran. The gap was invisible until a customer reconciled refunds by hand.

Three changes

First, persist before acknowledging. The handler now writes the raw body to a durable log and returns only after that write is committed. Median latency went from 6 ms to 19 ms. We accepted that trade.

Second, make ingestion idempotent by provider key. Every payload carries the provider's event id, and we deduplicate on (workspace, provider, event_id) with a 72-hour window. The 340 duplicate refunds collapsed to one run and 339 recorded duplicates.

Third, separate admission from execution. Acknowledging a webhook now only means "durably received". Scheduling the run happens afterwards, driven by a consumer that can fall behind without losing anything. Backpressure shows up as ingest lag in our dashboards rather than as dropped events.

What we measure now

MetricBeforeAfter
p99 ingest latency8 ms31 ms
Silent dropsunknown0 by construction
Duplicate runs per 10k events~1400.3
Recovery from consumer stallmanual replayautomatic, bounded lag

The uncomfortable part

Admitting you cannot acknowledge in 6 ms is the whole fix. Every alternative we tried — bigger channels, more workers, shed at the edge — moved the failure rather than removing it. Durable-then-ack is slower on the happy path and the only version we can describe honestly in an incident report.

If you are building webhook ingestion, the rule is short: the 2xx is a durability claim. Do not spend it before you can back it up.