mirror of
https://gitlab.com/famedly/conduit.git
synced 2024-11-04 17:29:14 +01:00
improvement: longer timeout, more descriptive errors
This commit is contained in:
parent
76660bf189
commit
55a2ff025f
2 changed files with 6 additions and 4 deletions
|
@ -55,6 +55,7 @@ impl Engine {
|
||||||
conn.pragma_update(Some(Main), "journal_mode", &"WAL")?;
|
conn.pragma_update(Some(Main), "journal_mode", &"WAL")?;
|
||||||
conn.pragma_update(Some(Main), "synchronous", &"NORMAL")?;
|
conn.pragma_update(Some(Main), "synchronous", &"NORMAL")?;
|
||||||
conn.pragma_update(Some(Main), "cache_size", &(-i64::from(cache_size_kb)))?;
|
conn.pragma_update(Some(Main), "cache_size", &(-i64::from(cache_size_kb)))?;
|
||||||
|
conn.pragma_update(Some(Main), "wal_autocheckpoint", &0)?;
|
||||||
|
|
||||||
Ok(conn)
|
Ok(conn)
|
||||||
}
|
}
|
||||||
|
|
|
@ -228,11 +228,9 @@ where
|
||||||
.headers_mut()
|
.headers_mut()
|
||||||
.insert(HOST, HeaderValue::from_str(&host).unwrap());
|
.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");
|
.expect("all http requests are valid reqwest requests");
|
||||||
|
|
||||||
*reqwest_request.timeout_mut() = Some(Duration::from_secs(30));
|
|
||||||
|
|
||||||
let url = reqwest_request.url().clone();
|
let url = reqwest_request.url().clone();
|
||||||
let response = globals.reqwest_client().execute(reqwest_request).await;
|
let response = globals.reqwest_client().execute(reqwest_request).await;
|
||||||
|
|
||||||
|
@ -273,7 +271,10 @@ where
|
||||||
|
|
||||||
if status == 200 {
|
if status == 200 {
|
||||||
let response = T::IncomingResponse::try_from_http_response(http_response);
|
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 {
|
} else {
|
||||||
Err(Error::FederationError(
|
Err(Error::FederationError(
|
||||||
destination.to_owned(),
|
destination.to_owned(),
|
||||||
|
|
Loading…
Reference in a new issue