move to const

This commit is contained in:
Felix Ableitner 2024-05-08 10:44:41 +02:00
parent e34e6a837a
commit e91c5dcd5b

View File

@ -31,6 +31,8 @@ mod post;
pub mod routes; pub mod routes;
pub mod site; pub mod site;
const INCOMING_ACTIVITY_TIMEOUT: Duration = Duration::from_secs(9);
pub async fn shared_inbox( pub async fn shared_inbox(
request: HttpRequest, request: HttpRequest,
body: Bytes, body: Bytes,
@ -42,7 +44,7 @@ pub async fn shared_inbox(
// avoid taking a long time to process an incoming activity when a required data fetch times out. // avoid taking a long time to process an incoming activity when a required data fetch times out.
// In this case our own instance would timeout and be marked as dead by the sender. Better to // In this case our own instance would timeout and be marked as dead by the sender. Better to
// consider the activity broken and move on. // consider the activity broken and move on.
timeout(Duration::from_secs(9), receive_fut) timeout(INCOMING_ACTIVITY_TIMEOUT, receive_fut)
.await .await
.map_err(|_| LemmyErrorType::InboxTimeout)? .map_err(|_| LemmyErrorType::InboxTimeout)?
} }