From c307f8d81378e17854c0c967f25767f9396570f5 Mon Sep 17 00:00:00 2001 From: Joel Natividad <1980690+jqnatividad@users.noreply.github.com> Date: Fri, 11 Oct 2024 18:44:51 -0400 Subject: [PATCH] `stats`, `frequency`: import crossbeam_channel only in these two modules --- src/cmd/frequency.rs | 3 ++- src/cmd/stats.rs | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/cmd/frequency.rs b/src/cmd/frequency.rs index f68907c13..33c8826bc 100644 --- a/src/cmd/frequency.rs +++ b/src/cmd/frequency.rs @@ -121,6 +121,7 @@ Common options: use std::{fs, io, sync::OnceLock}; +use crossbeam_channel; use indicatif::HumanCount; use rust_decimal::prelude::*; use serde::Deserialize; @@ -391,7 +392,7 @@ impl Args { let nchunks = util::num_of_chunks(idx_count, chunk_size); let pool = ThreadPool::new(njobs); - let (send, recv) = channel::bounded(0); + let (send, recv) = crossbeam_channel::bounded(0); for i in 0..nchunks { let (send, args, sel) = (send.clone(), self.clone(), sel.clone()); pool.execute(move || { diff --git a/src/cmd/stats.rs b/src/cmd/stats.rs index ef5addc5d..4896da189 100644 --- a/src/cmd/stats.rs +++ b/src/cmd/stats.rs @@ -246,6 +246,7 @@ use std::{ sync::OnceLock, }; +use crossbeam_channel; use itertools::Itertools; use qsv_dateparser::parse_with_preference; use serde::{Deserialize, Serialize}; @@ -933,7 +934,7 @@ impl Args { let nchunks = util::num_of_chunks(idx_count as usize, chunk_size); let pool = ThreadPool::new(util::njobs(self.flag_jobs)); - let (send, recv) = channel::bounded(0); + let (send, recv) = crossbeam_channel::bounded(0); for i in 0..nchunks { let (send, args, sel) = (send.clone(), self.clone(), sel.clone()); pool.execute(move || { @@ -961,7 +962,7 @@ impl Args { let pool = ThreadPool::new(util::njobs(self.flag_jobs)); let mut results = Vec::with_capacity(stats.len()); for mut stat in stats { - let (send, recv) = channel::bounded(0); + let (send, recv) = crossbeam_channel::bounded(0); results.push(recv); pool.execute(move || { // safety: this will only return an Error if the channel has been disconnected