pub async fn run_periodic_task<Name, State, IntervalFn, TaskFn, TaskFut, PanicFn, RecordFn, RecordFut, Outcome>(
task: PeriodicTask<Name, State, IntervalFn, TaskFn, PanicFn, RecordFn>,
)where
Name: Copy + Send + 'static,
State: Clone + Send + Sync + 'static,
IntervalFn: Fn(&State) -> Duration + Send + Sync + 'static,
TaskFn: Fn(State) -> TaskFut + Send + Sync + 'static,
TaskFut: Future<Output = Outcome> + Send,
PanicFn: Fn(String) -> Outcome + Send + Sync + 'static,
RecordFn: Fn(State, Name, DateTime<Utc>, DateTime<Utc>, Outcome) -> RecordFut + Send + Sync + 'static,
RecordFut: Future<Output = ()> + Send,
Outcome: Send + 'static,Expand description
Runs a periodic task until shutdown.
The first iteration runs immediately unless the token is already cancelled. Each later
iteration sleeps using the latest product-provided interval and optional jitter cap. Panics in
one iteration are converted into a product outcome through panic_outcome and then recorded by
record_outcome; they do not kill the worker loop.