#retry #async

named-retry

A simple utility for retrying fallible asynchronous operations

3 unstable releases

0.2.1 Mar 17, 2023
0.2.0 Aug 18, 2022
0.1.0 Jul 26, 2022

#454 in Asynchronous

Download history 8/week @ 2022-12-06 8/week @ 2022-12-13 8/week @ 2022-12-20 11/week @ 2022-12-27 5/week @ 2023-01-03 7/week @ 2023-01-10 4/week @ 2023-01-17 16/week @ 2023-01-24 20/week @ 2023-01-31 13/week @ 2023-02-07 29/week @ 2023-02-14 27/week @ 2023-02-21 4/week @ 2023-02-28 8/week @ 2023-03-07 43/week @ 2023-03-14 10/week @ 2023-03-21

68 downloads per month
Used in blobnet

MIT license

7KB
117 lines

named-retry

This is a simple, impl Copy utility for retrying fallible asynchronous operations, with helpful log messages through tracing.

use std::time::Duration;
use named_retry::Retry;

let retry = Retry::new("test")
    .attempts(5)
    .base_delay(Duration::from_secs(1))
    .delay_factor(2.0);

let result = retry.run(|| async { Ok::<_, ()>("done!") }).await;
assert_eq!(result, Ok("done!"));

lib.rs:

Utilities for retrying falliable, asynchronous operations.

Dependencies

~2.2–6MB
~89K SLoC