bouncer

Crates.iobouncer
lib.rsbouncer
version1.0.1
sourcesrc
created_at2020-10-24 21:49:46.103952
updated_at2021-08-30 00:22:00.758584
descriptionBouncer allows you handle your requests to third-party services with no worries, perhaps some worries.
homepagehttps://github.com/thelastinuit/bouncer
repositoryhttps://github.com/thelastinuit/bouncer.git
max_upload_size
id305143
size1,514,850
luis ignacio cejudo fontes (empanacho)

documentation

https://github.com/thelastinuit/bouncer

README

Rupertou

Bouncer helps you to manage your requests to third-party services.

Setup

In order to use Bouncer, you need Redis as a backend. Then you can configure Redis URI:

#config/default.toml

server_url="redis://username:password@redis/"

Usage

Imagine you have a function that makes a request to a services.

fn dummy_function() {
    let mut easy = Easy::new();
    easy.url("http://httpbin.org/delay/3").unwrap();
    easy.write_function(|data| {
      stdout().write_all(data).unwrap();
      Ok(data.len())
    }).unwrap();
    easy.perform().unwrap();
}

You can use bouncer to call that function many times in many place i.e. asynch jobs and let bouncer handle the request.

bouncer::run(KEY, RATE_LIMIT, WAIT_TIME, &dummy_function)
Commit count: 10

cargo fmt