Delivery and retries
When Peal retries a delivery, in what order events arrive, and the delivery log.
Peal retries a failed delivery for about a day. Here’s when each attempt happens, what your server should expect, and how to resend a delivery from the log.
When Peal tries again
Your server has 15 seconds to answer. Any 2xx status counts as delivered. Everything else is a failure, redirects (3xx) included, and so is no answer in time or a connection that can’t be made or breaks.
Peal retries a failed delivery up to seven times over about a day, so 8 attempts in all:
| Attempt | When |
|---|---|
| 1 | At once |
| 2 | 5 seconds after the first failed |
| 3 | 5 minutes after the second failed |
| 4 | 30 minutes after the third failed |
| 5 | 2 hours after the fourth failed |
| 6 | 5 hours after the fifth failed |
| 7 | 8 hours after the sixth failed |
| 8 | 8 hours after the seventh failed |
After the eighth attempt the delivery is marked failed, and you can still resend it by hand. While the endpoint stays on, the members who manage webhooks get a notification, and an email unless they turned it off. They’re told once a day at most for each endpoint.
When Peal turns an endpoint off
Peal turns an endpoint off on its own in two cases, and then tells the members who manage webhooks, with a notification and an email:
| Case | What happens |
|---|---|
It answers 410 Gone |
Peal stops at once and turns the endpoint off. A 410 means your server doesn’t want these events any more. |
| Every attempt has failed for 5 days | Peal turns the endpoint off. A single success in between starts the count again. |
Once your server answers again, turn the endpoint back on. It gets its 5 days again.
Order and duplicates
Deliveries can arrive out of order, and more than once. Each event is delivered on its own, with its own retries, so an event whose first attempt failed arrives after events that happened later. An attempt your server answered too late, or whose answer was lost, is made again.
Your server should handle both:
- Store the
webhook-idof each event you handle, and answer a 2xx to one you’ve already seen. - Don’t rely on arrival order. Sort events by the instants in
data(publishedAt,failedAt,scheduledAtand so on) and the event’stimestamp. When you need a post’s or a channel’s current state, read it through the API.
The delivery log
Each endpoint has a log of its deliveries, newest first, kept for 30 days. For each delivery it shows:
| Column | What it shows |
|---|---|
| Event | The event’s type and id |
| Status | Pending, succeeded or failed. A failed one says why: every attempt failed, the endpoint answered 410 Gone, the endpoint was turned off before the delivery got through, or the instance can no longer read the endpoint’s secret |
| Answer | The status your server gave the last attempt, or why no answer came: none in time, a connection that failed, or an address Peal no longer sends to |
| Attempts | How long the last attempt took, how many attempts were made, and when the next one is |
When an answer wasn’t a success, the log keeps the start of what your server said, so you can tell what went wrong: one line, 256 characters at most. Peal keeps nothing else of an answer, and nothing at all of a successful one.
Across endpoints
The workspace’s log lists every delivery of every endpoint, newest first. You can filter it by status, endpoint, event type and when the delivery was made (from since, before until). A delivery sent again names the one it repeats (redeliveryOf).
A partner endpoint’s deliveries are in its home workspace’s log, including those for the partner’s other workspaces. Each one names the workspace the event happened in (workspaceId) and the partner’s own id for it (workspaceExternalId).
After an outage, look at the deliveries that failed for good (status failed). The web app shows them in the Failed tab for 30 days, with the receiver’s last answer.
Test and send again
These actions help while you build your receiver, and after an outage:
| Action | What it does |
|---|---|
| Send a test event | Sends the endpoint a webhook.test event, or a sample of the type you choose. |
| Send again | Sends a delivery’s event to the endpoint once more, as a new delivery of the same event: same webhook-id, same body, a new timestamp and a new signature. A server that deduplicates sees it as one it has already handled. |
| Send all failed again | Sends an endpoint’s failed deliveries once more, oldest first, 100 a call at most, and only the last delivery of each event. Over the API you can name up to 100 deliveries instead. |
Test events and single resends need the endpoint to be on.
When you send many again, Peal skips a delivery if its endpoint is off, if it isn’t the workspace’s, or if its event was sent again since and that delivery is pending or went through (alreadySent). So calling again after a partial run never sends anything twice. The answer lists what was sent and what was skipped, and how many failed deliveries the selection still holds (remaining).
An endpoint’s new deliveries start a quarter of a second apart, so a server that has just come back isn’t sent them all at once.