improvement: function to check pool capacity

This commit is contained in:
Greg Heartsfield 2022-12-20 10:07:01 -06:00
parent ce37fc1a2d
commit 86bb7aeb9a

View File

@ -614,6 +614,12 @@ fn query_from_sub(sub: &Subscription) -> (String, Vec<Box<dyn ToSql>>) {
(query, params) (query, params)
} }
/// Check if the pool is fully utilized
fn _pool_at_capacity(pool: &SqlitePool) -> bool {
let state: r2d2::State = pool.state();
state.idle_connections == 0
}
fn log_pool_stats(pool: &SqlitePool) { fn log_pool_stats(pool: &SqlitePool) {
let state: r2d2::State = pool.state(); let state: r2d2::State = pool.state();
let in_use_cxns = state.connections - state.idle_connections; let in_use_cxns = state.connections - state.idle_connections;