Skip to main content

task_with_retry_and_timeout

Function task_with_retry_and_timeout 

Source
pub fn task_with_retry_and_timeout<M, F>(
    policy: RetryPolicy,
    per_attempt_timeout: Duration,
    f: F,
    on_exhaust: fn(String) -> M,
) -> Cmd<M>
where M: Send + 'static, F: Fn(CancellationToken) -> Result<M, String> + Send + Sync + 'static,
Expand description

Create a Cmd::Task with both retry and timeout.

Each individual attempt is bounded by per_attempt_timeout. The worker receives a CancellationToken and must honor it for timely timeout teardown. The total number of attempts is governed by the retry policy.