#circuit-breaker #bb8 #bb8-connection #connection-pool #thin #wapper #captilites

bb8-failsafe

thin wapper of failsafe-rs to provide circuit breaker captilites to bb8

18 releases

0.1.17 Nov 15, 2024
0.1.14 Aug 1, 2024
0.1.13 Jul 8, 2024
0.1.9 Mar 25, 2024
0.1.1 May 23, 2022

#1226 in Database interfaces

Download history 17/week @ 2024-09-23 24/week @ 2024-09-30 175/week @ 2024-10-07 38/week @ 2024-10-14 167/week @ 2024-10-21 22/week @ 2024-10-28 50/week @ 2024-11-04 118/week @ 2024-11-11 46/week @ 2024-11-18 24/week @ 2024-11-25 16/week @ 2024-12-02 22/week @ 2024-12-09

119 downloads per month

MIT license

7KB
114 lines

bb8-failsafe

thin wapper of failsafe-rs to provide circuit breaker captilites to bb8


lib.rs:

thin wapper of failsafe-rs to provide circuit breaker captilites to bb8.

Example

Using an imaginary "foodb" database.

#[tokio::main]
async fn main() {
    let manager = bb8_foodb::FooConnectionManager::new("localhost:1234");
    let circuitbreaker = bb8_failsafe::failsafe::Config::new().build();
    let safemanager = bb8_failsafe::FailsafeConnectionManager::new(manager, circuitbreaker);
    let pool = bb8::Pool::builder().build(safemanager).await.unwrap();

    for _ in 0..20 {
        let pool = pool.clone();
        tokio::spawn(async move {
            let conn = pool.get().await.unwrap();
            // use the connection
            // it will be returned to the pool when it falls out of scope.
        });
    }
}

Dependencies

~3.5–9.5MB
~93K SLoC