convert std::sync::mpsc to crossbeam_channel (#22264)

This commit is contained in:
Jeff Biseda
2022-01-11 02:44:46 -08:00
committed by GitHub
parent 3c44d405c7
commit 8b66625c95
81 changed files with 313 additions and 346 deletions

View File

@@ -10,6 +10,7 @@ documentation = "https://docs.rs/solana-metrics"
edition = "2021"
[dependencies]
crossbeam-channel = "0.5"
gethostname = "0.2.1"
lazy_static = "1.4.0"
log = "0.4.14"

View File

@@ -2,6 +2,7 @@
use {
crate::{counter::CounterPoint, datapoint::DataPoint},
crossbeam_channel::{unbounded, Receiver, RecvTimeoutError, Sender},
gethostname::gethostname,
lazy_static::lazy_static,
log::*,
@@ -11,10 +12,7 @@ use {
collections::HashMap,
convert::Into,
env,
sync::{
mpsc::{channel, Receiver, RecvTimeoutError, Sender},
Arc, Barrier, Mutex, Once, RwLock,
},
sync::{Arc, Barrier, Mutex, Once, RwLock},
thread,
time::{Duration, Instant, UNIX_EPOCH},
},
@@ -155,7 +153,7 @@ impl MetricsAgent {
write_frequency: Duration,
max_points_per_sec: usize,
) -> Self {
let (sender, receiver) = channel::<MetricsCommand>();
let (sender, receiver) = unbounded::<MetricsCommand>();
thread::spawn(move || Self::run(&receiver, &writer, write_frequency, max_points_per_sec));
Self { sender }