mirror of
https://github.com/catdevnull/preciazo.git
synced 2024-11-21 22:16:18 +00:00
usar 50 coroutinas en coto
This commit is contained in:
parent
5943d80252
commit
adf1d7ac59
2 changed files with 13 additions and 6 deletions
|
@ -1,3 +1,5 @@
|
|||
use std::env;
|
||||
|
||||
use super::now_sec;
|
||||
use super::AutoArgs;
|
||||
use super::AutoTelegram;
|
||||
|
@ -61,7 +63,16 @@ impl Auto {
|
|||
// }
|
||||
{
|
||||
let t0 = now_sec();
|
||||
let counters = self.scraper.fetch_list(&self.db, links).await;
|
||||
|
||||
let n_coroutines = if supermercado == Supermercado::Coto {
|
||||
50
|
||||
} else {
|
||||
env::var("N_COROUTINES")
|
||||
.map_or(Ok(24), |s| s.parse::<usize>())
|
||||
.expect("N_COROUTINES no es un número")
|
||||
};
|
||||
|
||||
let counters = self.scraper.fetch_list(&self.db, links, n_coroutines).await;
|
||||
self.inform(&format!(
|
||||
"Downloaded {:?}: {:?} (took {})",
|
||||
&supermercado,
|
||||
|
|
|
@ -128,11 +128,7 @@ impl Scraper {
|
|||
counters
|
||||
}
|
||||
|
||||
pub async fn fetch_list(&self, db: &Db, links: Vec<String>) -> Counters {
|
||||
let n_coroutines = env::var("N_COROUTINES")
|
||||
.map_or(Ok(24), |s| s.parse::<usize>())
|
||||
.expect("N_COROUTINES no es un número");
|
||||
|
||||
pub async fn fetch_list(&self, db: &Db, links: Vec<String>, n_coroutines: usize) -> Counters {
|
||||
stream::iter(links)
|
||||
.map(|url| {
|
||||
let db = db.clone();
|
||||
|
|
Loading…
Reference in a new issue