warcificator : conseguir threads de env

This commit is contained in:
Cat /dev/Nulo 2024-01-08 11:51:07 -03:00
parent abd430421c
commit 2d2912e4e9

View file

@ -10,7 +10,7 @@ use tl::VDom;
// use scraper::{Element, Html, Selector}; // use scraper::{Element, Html, Selector};
use std::{ use std::{
borrow::Cow, borrow::Cow,
env::args, env::{self, args},
fs, fs,
ops::Deref, ops::Deref,
time::{SystemTime, UNIX_EPOCH}, time::{SystemTime, UNIX_EPOCH},
@ -150,7 +150,10 @@ async fn main() {
let (res_sender, res_receiver) = async_channel::unbounded::<PrecioPoint>(); let (res_sender, res_receiver) = async_channel::unbounded::<PrecioPoint>();
let mut handles = Vec::new(); let mut handles = Vec::new();
for _ in 1..32 { for _ in 1..env::var("N_COROUTINES")
.map_or(Ok(32), |s| s.parse::<usize>())
.unwrap()
{
let rx = receiver.clone(); let rx = receiver.clone();
let tx = res_sender.clone(); let tx = res_sender.clone();
handles.push(tokio::spawn(worker(rx, tx))); handles.push(tokio::spawn(worker(rx, tx)));