athena_rs 3.3.0

Database gateway API
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use once_cell::sync::Lazy;
use std::time::Duration;

const DEFAULT_DEADPOOL_CHECKOUT_TIMEOUT_MS: u64 = 800;

static DEADPOOL_CHECKOUT_TIMEOUT: Lazy<Duration> = Lazy::new(|| {
    let timeout_ms: u64 = std::env::var("ATHENA_DEADPOOL_CHECKOUT_TIMEOUT_MS")
        .ok()
        .and_then(|value| value.parse::<u64>().ok())
        .filter(|value| *value > 0)
        .unwrap_or(DEFAULT_DEADPOOL_CHECKOUT_TIMEOUT_MS);
    Duration::from_millis(timeout_ms)
});

pub fn deadpool_checkout_timeout() -> Duration {
    *DEADPOOL_CHECKOUT_TIMEOUT
}