Threadbar
Webhook deliveries that fail are dropped. Retry them with exponential backoff, at most five tries, and log each attempt.
- Searcheddeliver_webhook3 matches in 2 files
- Readsrc/webhooks/deliver.rslines 1–88
- Editedsrc/webhooks/deliver.rs+18 −4
- Rancargo test webhooks12 passed in 4.1 s
src/webhooks/deliver.rs+18−4
pub async fn deliver(hook: &Hook, body: &[u8]) -> Result<()> {- let res = client().post(&hook.url).body(body).send().await?;- res.error_for_status()?;+ for attempt in 0..MAX_TRIES {+ match try_once(hook, body).await {+ Ok(()) => return Ok(()),+ Err(e) => log_attempt(hook, attempt, &e),+ }+ sleep(backoff(attempt)).await;
Running the webhook tests