From 55a2ff025fefe89118dd2b3244151fe3492f1fd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20K=C3=B6sters?= Date: Wed, 4 Aug 2021 22:55:03 +0200 Subject: [PATCH] improvement: longer timeout, more descriptive errors --- src/database/abstraction/sqlite.rs | 1 + src/server_server.rs | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/database/abstraction/sqlite.rs b/src/database/abstraction/sqlite.rs index 0dbb2615..72fb5f7f 100644 --- a/src/database/abstraction/sqlite.rs +++ b/src/database/abstraction/sqlite.rs @@ -55,6 +55,7 @@ impl Engine { conn.pragma_update(Some(Main), "journal_mode", &"WAL")?; conn.pragma_update(Some(Main), "synchronous", &"NORMAL")?; conn.pragma_update(Some(Main), "cache_size", &(-i64::from(cache_size_kb)))?; + conn.pragma_update(Some(Main), "wal_autocheckpoint", &0)?; Ok(conn) } diff --git a/src/server_server.rs b/src/server_server.rs index 45d90226..9ae42ad6 100644 --- a/src/server_server.rs +++ b/src/server_server.rs @@ -228,11 +228,9 @@ where .headers_mut() .insert(HOST, HeaderValue::from_str(&host).unwrap()); - let mut reqwest_request = reqwest::Request::try_from(http_request) + let reqwest_request = reqwest::Request::try_from(http_request) .expect("all http requests are valid reqwest requests"); - *reqwest_request.timeout_mut() = Some(Duration::from_secs(30)); - let url = reqwest_request.url().clone(); let response = globals.reqwest_client().execute(reqwest_request).await; @@ -273,7 +271,10 @@ where if status == 200 { let response = T::IncomingResponse::try_from_http_response(http_response); - response.map_err(|_| Error::BadServerResponse("Server returned bad 200 response.")) + response.map_err(|e| { + warn!("Invalid 200 response: {}", e); + Error::BadServerResponse("Server returned bad 200 response.") + }) } else { Err(Error::FederationError( destination.to_owned(),