remove async/spawn in Collector::collect

This commit is contained in:
Kevin Zimmerman
2023-07-25 19:53:57 -05:00
parent ae3241b634
commit 6eb01e51a0
2 changed files with 3 additions and 7 deletions

View File

@@ -160,10 +160,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
}
};
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),

View File

@@ -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 {