pub async fn run_scheduled_periodic_task<Name, State, Store, IntervalFn, TaskFn, TaskFut, PanicFn, RecordFn, RecordFut, Outcome>(
task: ScheduledPeriodicTask<Name, State, Store, IntervalFn, TaskFn, PanicFn, RecordFn>,
)where
Name: Copy + Send + 'static,
State: Clone + Send + Sync + 'static,
Store: ScheduledTaskStore,
IntervalFn: Fn(&State) -> Duration + Send + Sync + 'static,
TaskFn: Fn(State) -> TaskFut + Send + Sync + 'static,
TaskFut: Future<Output = Outcome> + Send + 'static,
PanicFn: Fn(String) -> Outcome + Send + Sync + 'static,
RecordFn: Fn(State, Name, ScheduledTaskClaim, DateTime<Utc>, DateTime<Utc>, Outcome) -> RecordFut + Send + Sync + 'static,
RecordFut: Future<Output = ()> + Send + 'static,
Outcome: Send + 'static,Expand description
Runs a scheduled periodic task until shutdown.
Unlike crate::run_periodic_task, this runner first claims a due catalog row. If the row is
not due, or another process owns a fresh claim, the worker skips that iteration. Successful and
failed task outcomes both complete the claim and advance next_run_at; crashes and process
exits before completion are recovered by claim expiry.
While the task body runs, a renewal loop extends the claim at
scheduled_claim_renew_interval ticks, so a task that outlives claim_ttl is not reclaimed
and executed twice by another runtime. Renewal failures never abort the task body: a lost
claim only stops the renewal loop, and completion still guards on ownership.