diff --git a/src/main.rs b/src/main.rs index 916d1a8..3d708d7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -160,10 +160,7 @@ fn main() -> Result<(), Box> { } }; - tokio::task::spawn(async move { - let mut stats_collector = Collector::default(); - stats_collector.collect().await; - }); + Collector::collect(); info!("Config autoreloader: {}", match config.general.autoreload { Some(interval) => format!("{} ms", interval), diff --git a/src/stats.rs b/src/stats.rs index 29c00d6..1a0b94f 100644 --- a/src/stats.rs +++ b/src/stats.rs @@ -77,13 +77,12 @@ impl Reporter { /// The statistics collector which used for calculating averages /// There is only one collector (kind of like a singleton) /// it updates averages every 15 seconds. -#[derive(Default)] -pub struct Collector {} +pub struct Collector; impl Collector { /// The statistics collection handler. It will collect statistics /// for `address_id`s starting at 0 up to `addresses`. - pub async fn collect(&mut self) { + pub fn collect() { info!("Events reporter started"); tokio::task::spawn(async move {