Skip to content

Commit

Permalink
stats, frequency: import crossbeam_channel only in these two modules
Browse files Browse the repository at this point in the history
  • Loading branch information
jqnatividad committed Oct 11, 2024
1 parent 6e9bb55 commit c307f8d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/cmd/frequency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 || {
Expand Down
5 changes: 3 additions & 2 deletions src/cmd/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ use std::{
sync::OnceLock,
};

use crossbeam_channel;
use itertools::Itertools;
use qsv_dateparser::parse_with_preference;
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -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 || {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c307f8d

Please sign in to comment.