athena_rs 3.4.7

Database driver
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;

use crate::config_validation::runtime_env_settings;

const DEFAULT_DEADPOOL_CHECKOUT_TIMEOUT_MS: u64 = 800;

static DEADPOOL_CHECKOUT_TIMEOUT: Lazy<Duration> = Lazy::new(|| {
    let timeout_ms: u64 = runtime_env_settings()
        .deadpool_checkout_timeout_ms
        .max(DEFAULT_DEADPOOL_CHECKOUT_TIMEOUT_MS);
    Duration::from_millis(timeout_ms)
});

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