Skip to content
/ backon Public
forked from Xuanwo/backon

Another implementation of backoff via Iterator.

License

Notifications You must be signed in to change notification settings

wfxr/backon

 
 

Repository files navigation

backon   Build Status Latest Version

Retry futures in backoff without effort.


The opposite backoff implementation of the popular backoff.

  • Newer: developed by Rust edition 2021 and latest stable.
  • Cleaner: Iterator based abstraction, easy to use, customization friendly.
  • Easier: Trait based implementations, works like a native function provided by closures.

Quick Start

use backon::Retryable;
use backon::ExponentialBackoff;
use anyhow::Result;

async fn fetch() -> Result<String> {
    Ok(reqwest::get("https://www.rust-lang.org").await?.text().await?)
}

#[tokio::main]
async fn main() -> Result<()> {
    let content = fetch.retry(ExponentialBackoff::default()).await?;
    println!("fetch succeeded: {}", content);

    Ok(())
}

Contributing

Check out the CONTRIBUTING.md guide for more details on getting started with contributing to this project.

Getting help

Submit issues for bug report or asking questions in discussion.

License

Licensed under Apache License, Version 2.0.

About

Another implementation of backoff via Iterator.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 100.0%