Skip to main content

run_periodic_worker

Function run_periodic_worker 

Source
pub async fn run_periodic_worker(
    config: PeriodicWorkerConfig<'_>,
    body: impl AsyncFnMut() -> Result<()>,
) -> Result<()>
Expand description

Runs body on config.tick_interval forever, logging config.still_running_message every config.still_running_every ticks. A body that returns Err stops the loop and becomes this function’s return value, the same as an unhandled error used to exit the worker’s main.