From 2d2912e4e987d5e79dfe986b024dccaba622fbc7 Mon Sep 17 00:00:00 2001 From: Nulo Date: Mon, 8 Jan 2024 11:51:07 -0300 Subject: [PATCH] warcificator : conseguir threads de env --- warcificator/src/main.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/warcificator/src/main.rs b/warcificator/src/main.rs index 5311b41..575a683 100644 --- a/warcificator/src/main.rs +++ b/warcificator/src/main.rs @@ -10,7 +10,7 @@ use tl::VDom; // use scraper::{Element, Html, Selector}; use std::{ borrow::Cow, - env::args, + env::{self, args}, fs, ops::Deref, time::{SystemTime, UNIX_EPOCH}, @@ -150,7 +150,10 @@ async fn main() { let (res_sender, res_receiver) = async_channel::unbounded::(); let mut handles = Vec::new(); - for _ in 1..32 { + for _ in 1..env::var("N_COROUTINES") + .map_or(Ok(32), |s| s.parse::()) + .unwrap() + { let rx = receiver.clone(); let tx = res_sender.clone(); handles.push(tokio::spawn(worker(rx, tx)));