• Stars
    star
    336
  • Rank 125,564 (Top 3 %)
  • Language
    Rust
  • License
    Apache License 2.0
  • Created over 2 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Retry with backoff without effort.

backon   Build Status Latest Version

Retry with 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

Retry a blocking function.

use anyhow::Result;
use backon::BlockingRetryable;
use backon::ExponentialBuilder;

fn fetch() -> Result<String> {
     Ok("hello, world!".to_string())
}

fn main() -> Result<()> {
    let content = fetch.retry(&ExponentialBuilder::default()).call()?;
    println!("fetch succeeded: {}", content);

    Ok(())
}

Retry an async function.

use anyhow::Result;
use backon::ExponentialBuilder;
use backon::Retryable;

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(&ExponentialBuilder::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.

More Repositories

1

WebsitesForStudents

本库旨在建设一个对大学生有益有用的集合,欢迎参与。
Python
345
star
2

gg

General Golang Code Generator
Go
162
star
3

reqsign

Signing HTTP requests without heavy SDKs.
Rust
93
star
4

go-locale

Cross platform locale detection for Golang
Go
90
star
5

remote-work-spectrum

Remote work spectrum
54
star
6

blog

All my thinking land down here.
JavaScript
43
star
7

beancollect

beancollect helps your collect beans so that you can count them.
Go
25
star
8

serfig

Layered configuration system built upon serde
Rust
24
star
9

keyboard-coming

我陈平安,唯有一键,可搬山,倒海,降妖,镇魔,敕神,摘星,断江,摧城,开天!
22
star
10

hdrs

HDFS Native Client in Rust via HDFS C API libhdfs
Rust
20
star
11

xuanzang

A fulltext search backend, especially for static website having sitemap.
Go
17
star
12

serde-bridge

A bridge between different serde implementations.
Rust
16
star
13

github-saved-replies

Building github saved replies
JavaScript
14
star
14

formwork

formwork is my favourite rust template
Rust
11
star
15

serde-go

Serialize and Deserialize Golang data structures efficiently and generically
Go
10
star
16

learn-data-lake-from-storage

Learn Data Lake From Storage Layer.
9
star
17

tiresias

A tool to help you access your servers.
Go
9
star
18

globiter

Turn glob range and set into Iterator
Rust
8
star
19

qingchat

Python
8
star
20

serde-env

env support for serde
Rust
7
star
21

hdfs-sys

Bindings to HDFS Native C API.
C
7
star
22

SublimeForWiz

听说你们都喜欢Sublime?
JavaScript
7
star
23

hdfs-rpc

Rust Native Client for HDFS RPC
Rust
6
star
24

Learning

Open Learning, Growing Together.
6
star
25

jade-ims

Jade inventory management system , 玉石进销存管理系统
HTML
6
star
26

auto-add-to-project

Add issues and PRs into project automatically!
Go
5
star
27

gitqus

disqus alternative via git
Go
4
star
28

go-mod-redirect

Go
4
star
29

when-i-find-rust-is-slow

It's crazy, I found a case where Rust is slower than Python! But, really?
Python
4
star
30

syringa

A bridge to lilac for archlinuxcn.
Rust
3
star
31

bard

A pastebin service
Go
3
star
32

streamlit-store

Python
3
star
33

onobot

Rust
3
star
34

hcl2-example

Go
2
star
35

CodeforcesGrabber

A Crabber for Codeforces Contest
C++
2
star
36

atomdns

Go
2
star
37

go-bufferpool

buffer pool for Golang.
Go
2
star
38

qi

qi(炁) is a RESTful client and server generator for human
Rust
1
star
39

navvy

Go
1
star
40

reqwest-hickory-resolver

The hickory-dns resolver for reqwest
Rust
1
star
41

tokio-tcpstream-with-busy-estab

Python
1
star
42

CLIWiki

A wiki for all command
CSS
1
star
43

serde-msgpack-go

serde-go + vmihailenco/msgpack = serde-msgpack-go
Go
1
star
44

Xuanwo

1
star
45

go-record-jar

Record jar (https://tools.ietf.org/html/draft-phillips-record-jar-01) support for the Go language.
Go
1
star
46

serde_header

Strongly typed HTTP Header library for Rust, built upon serde
Rust
1
star