From 38dc7789dc2a4fddbb8f0e999b124643b84a5484 Mon Sep 17 00:00:00 2001 From: Greg Heartsfield Date: Sun, 25 Dec 2022 10:45:27 -0600 Subject: [PATCH] improvement: cleaner slow query logs --- src/db.rs | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/src/db.rs b/src/db.rs index 882507d..7ee1720 100644 --- a/src/db.rs +++ b/src/db.rs @@ -784,24 +784,7 @@ pub async fn db_query( "query req (slow): {:?} (cid: {}, sub: {:?})", sub, client_id, sub.id ); - debug!( - "query string (slow): {} (cid: {}, sub: {:?})", - q, client_id, sub.id - ); - } else { - trace!( - "query req: {:?} (cid: {}, sub: {:?})", - sub, - client_id, - sub.id - ); - trace!( - "query string: {} (cid: {}, sub: {:?})", - q, - client_id, - sub.id - ); - } + } // check if this is still active; every 100 rows if row_count % 100 == 0 && abandon_query_rx.try_recv().is_ok() { debug!("query aborted (cid: {}, sub: {:?})", client_id, sub.id); @@ -818,7 +801,8 @@ pub async fn db_query( trace!("db reader thread is stalled"); if last_successful_send + abort_cutoff < Instant::now() { // the queue has been full for too long, abort - info!("aborting database query due to slow client"); + info!("aborting database query due to slow client (cid: {}, sub: {:?})", + client_id, sub.id); let ok: Result<()> = Ok(()); return ok; }