mirror of
https://github.com/catdevnull/preciazo.git
synced 2024-11-23 06:36:19 +00:00
printear errores asap
This commit is contained in:
parent
855c2c6799
commit
d93d5c2055
1 changed files with 12 additions and 4 deletions
|
@ -3,14 +3,13 @@ use chrono::{DateTime, Utc};
|
||||||
use clap::{Parser, ValueEnum};
|
use clap::{Parser, ValueEnum};
|
||||||
use cron::Schedule;
|
use cron::Schedule;
|
||||||
use db::Db;
|
use db::Db;
|
||||||
use futures::{future, stream, Future, StreamExt};
|
use futures::{future, stream, Future, StreamExt, TryFutureExt};
|
||||||
use nanoid::nanoid;
|
|
||||||
use reqwest::{header::HeaderMap, StatusCode, Url};
|
use reqwest::{header::HeaderMap, StatusCode, Url};
|
||||||
use simple_error::{bail, SimpleError};
|
use simple_error::{bail, SimpleError};
|
||||||
use std::{
|
use std::{
|
||||||
env::{self},
|
env::{self},
|
||||||
fs,
|
fs,
|
||||||
path::PathBuf,
|
|
||||||
str::FromStr,
|
str::FromStr,
|
||||||
time::{Duration, SystemTime, UNIX_EPOCH},
|
time::{Duration, SystemTime, UNIX_EPOCH},
|
||||||
};
|
};
|
||||||
|
@ -425,7 +424,16 @@ async fn auto_cli(args: AutoArgs) -> anyhow::Result<()> {
|
||||||
|
|
||||||
let handles: Vec<_> = supermercados
|
let handles: Vec<_> = supermercados
|
||||||
.iter()
|
.iter()
|
||||||
.map(|s| tokio::spawn(auto.clone().download_supermercado(s.to_owned())))
|
.map(|s| {
|
||||||
|
let x = s.clone();
|
||||||
|
tokio::spawn(
|
||||||
|
auto.clone()
|
||||||
|
.download_supermercado(s.to_owned())
|
||||||
|
.inspect_err(move |err| {
|
||||||
|
tracing::error!(error=%err, supermercado=?x);
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
})
|
||||||
.collect();
|
.collect();
|
||||||
future::try_join_all(handles).await?;
|
future::try_join_all(handles).await?;
|
||||||
auto.inform("[auto] Download supermercados finished").await;
|
auto.inform("[auto] Download supermercados finished").await;
|
||||||
|
|
Loading…
Reference in a new issue