From 81aa39ba688bc5e396e35df5ca28986e74ac20d1 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Tue, 15 Feb 2022 07:53:57 -0500 Subject: [PATCH] Adding a reqwest timeout. Fixes #2089 (#2097) --- src/main.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 74f92fd17..3b6986afd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -31,7 +31,7 @@ use lemmy_websocket::{chat_server::ChatServer, LemmyContext}; use reqwest::Client; use reqwest_middleware::ClientBuilder; use reqwest_tracing::TracingMiddleware; -use std::{env, sync::Arc, thread}; +use std::{env, sync::Arc, thread, time::Duration}; use tokio::sync::Mutex; use tracing_actix_web::TracingLogger; @@ -96,6 +96,7 @@ async fn main() -> Result<(), LemmyError> { let client = Client::builder() .user_agent(build_user_agent(&settings)) + .timeout(Duration::from_secs(10)) .build()?; let client = ClientBuilder::new(client).with(TracingMiddleware).build();