Function spawn_retry_task

Source
pub fn spawn_retry_task<F, G>(
    task_fn: G,
    retry_policy: impl TaskRetryPolicy,
) -> JoinHandle<()>
where F: Future + Send + 'static, F::Output: Send + 'static, G: Fn() -> F + Send + Sync + 'static,
Expand description

Spawns a new tokio task with udf retry behaviour

  • task_fn generator function for the task future
let task_gen = move || {
    async move {
        1 + 1
    }
};

spawn_retry_task(task_gen, FailFast {})