Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GREEN-52125: Update webhook retry policy #556

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 11 additions & 24 deletions source/includes/webhooks/_introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,30 +188,17 @@ If a webhook is disabled, it will not trigger when the event occurs. Webhooks be

## Retry policy

In the event of a failed webhook request (due to timeout, a non HTTP 200 response, or network issues), Greenhouse will attempt a maximum of 6 retries according to the formula on the right:
In the event of a failed webhook request (due to timeout, a non HTTP 200 response, or network issues), Greenhouse will make up to 7 attempts over the course of 15 hours.

This formula increases the amount of time between each retry, while assigning a random number of seconds to avoid consistent failures from overload or contention.

Greenhouse will attempt 6 retries over the course of 15 hours.
The table below outlines the estimated wait time for each attempt.

```ruby
RETRY_DELAY_MINUTES = [1, 15, 60, 120, 240, 480]

sidekiq_retry_in do |index, _exception|
seconds_delay = (RETRY_DELAY_MINUTES[index] || RETRY_DELAY_MINUTES.last) * 60
offset = rand(30) * (index + 1)

seconds_delay + offset
end
```

The table below outlines the estimated wait time for each retry request, assuming that rand(30) always returns 0.

| Retry number | Next Retry in | Total waiting time |
| ------------ | ------------- | ------------------ |
| 1 | 1m | 0h 1m |
| 2 | 15m | 0h 16m |
| 3 | 60m | 1h 16m |
| 4 | 120m | 3h 16m |
| 5 | 240m | 7h 16m |
| 6 | 480m | 15h 16m |
| Approx. Total waiting time | Attempt number | Next Attempt in |
| :-------------------------- | :--------------: | :--------------- |
| 0h 0m | 1 | 1m |
| 0h 1m | 2 | 15m |
| 0h 16m | 3 | 60m |
| 1h 16m | 4 | 120m |
| 3h 16m | 5 | 240m |
| 7h 16m | 6 | 480m |
| 15h 16m | 7 | -- |