Reduced connection timeouts and added some logging
Some checks failed
Run Tests on Code / run-tests (push) Has been cancelled

This commit is contained in:
Neshura 2024-05-06 22:21:04 +02:00
parent 22bbaaa002
commit cd78d3c1c7
Signed by: Neshura
GPG key ID: B6983AAA6B9A7A6C
3 changed files with 6 additions and 4 deletions

View file

@ -102,6 +102,8 @@ pub(crate) async fn run() {
let series = config.series.clone();
for series in series {
let info_msg = format!("Handling Series {}", series.slug);
info!(info_msg);
if handle_series(&series, &communities, &lemmy, &config, &mut post_history)
.await
.is_err()

View file

@ -215,7 +215,7 @@ impl Lemmy {
match serde_json::from_str::<T>(response) {
Ok(data) => Ok(data),
Err(e) => {
let err_msg = format!("{e}");
let err_msg = format!("{e} while parsing JSON");
error!(err_msg);
Err(())
}
@ -226,7 +226,7 @@ impl Lemmy {
match serde_json::from_str::<HashMap<&str, T>>(response) {
Ok(mut data) => Ok(data.remove("post_view").expect("Element should be present")),
Err(e) => {
let err_msg = format!("{e}");
let err_msg = format!("{e} while parsing JSON HashMap");
error!(err_msg);
Err(())
}

View file

@ -12,8 +12,8 @@ mod fetchers;
pub static HTTP_CLIENT: Lazy<Client> = Lazy::new(|| {
Client::builder()
.timeout(Duration::seconds(30).to_std().unwrap())
.connect_timeout(Duration::seconds(30).to_std().unwrap())
.timeout(Duration::seconds(10).to_std().unwrap())
.connect_timeout(Duration::seconds(10).to_std().unwrap())
.build()
.expect("build client")
});