diff --git a/CHANGELOG.md b/CHANGELOG.md index dae900b..480e1dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Added - Set fetcher timeout to 3 minutes. +- Set deliverer timeout to 30 seconds. ## [1.14.0] - 2023-02-22 diff --git a/src/activitypub/deliverer.rs b/src/activitypub/deliverer.rs index 44461eb..4ac3a66 100644 --- a/src/activitypub/deliverer.rs +++ b/src/activitypub/deliverer.rs @@ -35,6 +35,8 @@ use super::constants::AP_MEDIA_TYPE; use super::identifiers::{local_actor_id, local_actor_key_id}; use super::queues::OutgoingActivityJobData; +const DELIVERER_TIMEOUT: u64 = 30; + #[derive(thiserror::Error, Debug)] pub enum DelivererError { #[error("key error")] @@ -65,7 +67,10 @@ fn build_client(instance: &Instance) -> reqwest::Result { let proxy = Proxy::all(proxy_url)?; client_builder = client_builder.proxy(proxy); }; - client_builder.build() + let timeout = Duration::from_secs(DELIVERER_TIMEOUT); + client_builder + .timeout(timeout) + .build() } async fn send_activity(