Web Hooks - honor Retry-After header when handling 429 Too Many Requests
Proposal
We currently consider all 4xx
responses for web-hooks to be evidence they are
misconfigured. Too many in a row result in the hook being disabled until users
intervene to reenable them.
However, the response 429 - Too many requests
should get different behavior:
we should:
- Back-off immediately (not after 3 such responses), since we have been told to back-off
- Honour the
Retry-After
header
Implementation details
We would add some special handling of the hook failure state when the log_data
shows that the response code was 429
and there was a Retry-After
header:
- Set the
WebHook#disabled_until
property to a time in future that honoursRetry-After
. - Set
WebHook#recent_failures
toWebHooks::AutoDisabling::FAILURE_THRESHOLD
so that the webhook is immediately backed off and will not retrigger untildisabled_until
.
Edited by Luke Duncalfe