How to use interval

        task::spawn( async {
            let mut interval = time::interval(Duration::from_millis(get_mining_info_interval));
            while let it  = interval.tick().await{
            }
        });

i want to use interval in a tokio. how can i execute some function in interval?

let mut i = tokio::time::interval(Duration::from_secs(1));
loop {
    // wait a seconds
    i.tick().await;
    // do something
}

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.