Reduced connection timeouts and added some logging
Some checks failed
Run Tests on Code / run-tests (push) Has been cancelled
Some checks failed
Run Tests on Code / run-tests (push) Has been cancelled
This commit is contained in:
parent
22bbaaa002
commit
cd78d3c1c7
3 changed files with 6 additions and 4 deletions
|
@ -102,6 +102,8 @@ pub(crate) async fn run() {
|
||||||
|
|
||||||
let series = config.series.clone();
|
let series = config.series.clone();
|
||||||
for series in series {
|
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)
|
if handle_series(&series, &communities, &lemmy, &config, &mut post_history)
|
||||||
.await
|
.await
|
||||||
.is_err()
|
.is_err()
|
||||||
|
|
|
@ -215,7 +215,7 @@ impl Lemmy {
|
||||||
match serde_json::from_str::<T>(response) {
|
match serde_json::from_str::<T>(response) {
|
||||||
Ok(data) => Ok(data),
|
Ok(data) => Ok(data),
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
let err_msg = format!("{e}");
|
let err_msg = format!("{e} while parsing JSON");
|
||||||
error!(err_msg);
|
error!(err_msg);
|
||||||
Err(())
|
Err(())
|
||||||
}
|
}
|
||||||
|
@ -226,7 +226,7 @@ impl Lemmy {
|
||||||
match serde_json::from_str::<HashMap<&str, T>>(response) {
|
match serde_json::from_str::<HashMap<&str, T>>(response) {
|
||||||
Ok(mut data) => Ok(data.remove("post_view").expect("Element should be present")),
|
Ok(mut data) => Ok(data.remove("post_view").expect("Element should be present")),
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
let err_msg = format!("{e}");
|
let err_msg = format!("{e} while parsing JSON HashMap");
|
||||||
error!(err_msg);
|
error!(err_msg);
|
||||||
Err(())
|
Err(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,8 +12,8 @@ mod fetchers;
|
||||||
|
|
||||||
pub static HTTP_CLIENT: Lazy<Client> = Lazy::new(|| {
|
pub static HTTP_CLIENT: Lazy<Client> = Lazy::new(|| {
|
||||||
Client::builder()
|
Client::builder()
|
||||||
.timeout(Duration::seconds(30).to_std().unwrap())
|
.timeout(Duration::seconds(10).to_std().unwrap())
|
||||||
.connect_timeout(Duration::seconds(30).to_std().unwrap())
|
.connect_timeout(Duration::seconds(10).to_std().unwrap())
|
||||||
.build()
|
.build()
|
||||||
.expect("build client")
|
.expect("build client")
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue