tdb_server_core 0.5.1

tectonicdb server
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//! history recorder
use crate::prelude::*;

use std::time;

pub async fn run(broker: Sender<Event>, settings: Arc<Settings>) {
    task::spawn(timer_loop(broker, settings));
}

pub async fn timer_loop(mut broker: Sender<Event>, settings: Arc<Settings>) {
    let dur = time::Duration::from_secs(settings.granularity);
    loop {
        broker.send(Event::RecordHistory).await.unwrap();
        task::sleep(dur).await;
    }
}