[BE] Log number of active/idle connections to investigate #37

This commit is contained in:
Araozu 2023-12-13 16:30:05 -05:00
parent bc671ea789
commit ad20a991e0

View File

@ -51,7 +51,12 @@ pub async fn db() -> Result<&'static Pool<MySql>, String> {
for _ in 0..attempts { for _ in 0..attempts {
match DB.get() { match DB.get() {
Some(db) => return Ok(db), Some(db) => {
log::info!("DB active connections: {}", db.size());
log::info!("DB num_idle connections: {}", db.num_idle());
return Ok(db)
},
None => { None => {
log::info!("DB not initialized, initializing from db()"); log::info!("DB not initialized, initializing from db()");
let _ = init_db().await; let _ = init_db().await;