Full lesson
Explore the full explanation, examples, and visuals at your own pace.
Part 1
During a sale, your backend goes down for an hour, and Shopify keeps sending orders. Order number 1001 reaches Hookdeck, which accepts it. But delivery to your Backend is refused, because nothing is answering. So what happens to that order while the backend is unreachable?
Step 1: each request becomes an event
Shopify sends the order webhook for order #1001 to Hookdeck, and Hookdeck creates an order event. Think of an event as Hookdeck's stored record of one delivery job. The first attempt to the Backend is refused. That failure is logged, but the event itself survives the outage.
Two ways an attempt fails
General knowledgeAn attempt can fail in two ways. When the server is off, Hookdeck gets CONNECTION_REFUSED right away. When the server hangs, Hookdeck connects but hears nothing, so after the default 60 seconds the attempt gets TIMEOUT. Either way, it's marked failed and handed to the retry rule.
Retry rule: same interval, two strategies
Take a ten-minute interval and three retries. With the linear strategy, Hookdeck retries at 10, 20, and 30 minutes after the failure. With exponential, each wait doubles, so retries land at 10, 20, and 40 minutes. In a one-hour outage, all three retries in both tables would fail.
Order #1001 through a one-hour outage
Here's order #1001 on a timeline. The first attempt fails at zero minutes. Retries at 10, 20, and 40 minutes also fail, because the backend is still down. The backend comes back at 60 minutes, and retry 4, at 80 minutes, finally gets through. The retry count has to outlast the outage.
Step 2: the backlog waits as Pending
While the backend is down, Shopify keeps sending orders, and Hookdeck turns each one into an event. Those events wait in the Pending queue. The max delivery rate is a cap on attempts per second. When the Backend comes back up, Hookdeck releases only 25 per second, and the rest stay Pending.
33,000 Pending at 25 per second
The backlog falls in a straight line, because Hookdeck releases events at a steady 25 per second. Divide 33,000 by 25 and you get 1,320 seconds, about 22 minutes. So even after the backend recovers, some late orders keep arriving for over twenty minutes.
Chart values
| Minutes after backend returns | Pending events |
|---|---|
| 0 min | 33000 |
| 5 min | 25500 |
| 10 min | 18000 |
| 15 min | 10500 |
| 20 min | 3000 |
| 22 min | 0 |
When automatic retries run out
General knowledgeAutomatic retries don't go on forever. The retry rule stops after 50 tries or one week, and the order event flips from retrying to failed. It's still stored, though. With the linear rule, that happens after the retry at 30 minutes. Manual retry can send order #1001 to the backend again, as often as you like.
Failed orders wait as events, retry on schedule, drain at your rate.
Failed orders wait as events, retry on schedule, and drain at your rate. So size your retry rule to outlast the outages you expect. And because delivery is at-least-once, the same order can arrive twice, so make your backend handle duplicates safely.