mirror of
https://github.com/scsibug/nostr-rs-relay.git
synced 2024-11-22 09:09:07 -05:00
improvement: function to check pool capacity
This commit is contained in:
parent
ce37fc1a2d
commit
86bb7aeb9a
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user