Adding a reqwest timeout. Fixes #2089 (#2097)

This commit is contained in:
Dessalines 2022-02-15 07:53:57 -05:00 committed by GitHub
parent 5a8c894359
commit 81aa39ba68
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -31,7 +31,7 @@ use lemmy_websocket::{chat_server::ChatServer, LemmyContext};
use reqwest::Client; use reqwest::Client;
use reqwest_middleware::ClientBuilder; use reqwest_middleware::ClientBuilder;
use reqwest_tracing::TracingMiddleware; use reqwest_tracing::TracingMiddleware;
use std::{env, sync::Arc, thread}; use std::{env, sync::Arc, thread, time::Duration};
use tokio::sync::Mutex; use tokio::sync::Mutex;
use tracing_actix_web::TracingLogger; use tracing_actix_web::TracingLogger;
@ -96,6 +96,7 @@ async fn main() -> Result<(), LemmyError> {
let client = Client::builder() let client = Client::builder()
.user_agent(build_user_agent(&settings)) .user_agent(build_user_agent(&settings))
.timeout(Duration::from_secs(10))
.build()?; .build()?;
let client = ClientBuilder::new(client).with(TracingMiddleware).build(); let client = ClientBuilder::new(client).with(TracingMiddleware).build();