Skip to content
Snippets Groups Projects
Unverified Commit 55a2ff02 authored by Timo Kösters's avatar Timo Kösters
Browse files

improvement: longer timeout, more descriptive errors

parent 76660bf1
No related branches found
No related tags found
No related merge requests found
......@@ -55,6 +55,7 @@ fn prepare_conn(path: &Path, cache_size_kb: u32) -> Result<Connection> {
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)
}
......
......@@ -228,11 +228,9 @@ pub async fn send_request<T: OutgoingRequest>(
.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 @@ pub async fn send_request<T: OutgoingRequest>(
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(),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment