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

bb8-failsafe

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

19 releases

new 0.1.18 Mar 21, 2025
0.1.17 Nov 15, 2024
0.1.16 Oct 21, 2024
0.1.13 Jul 8, 2024
0.1.1 May 23, 2022

#1433 in Database interfaces

Download history 20/week @ 2024-11-27 19/week @ 2024-12-04 25/week @ 2024-12-11 15/week @ 2024-12-18 11/week @ 2024-12-25 6/week @ 2025-01-01 4/week @ 2025-01-08 7/week @ 2025-01-29 3/week @ 2025-02-05 98/week @ 2025-02-12 7/week @ 2025-02-19 28/week @ 2025-02-26 8/week @ 2025-03-05 7/week @ 2025-03-12

55 downloads per month

MIT license

12KB
110 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–9MB
~79K SLoC