From 53c2a8051cf066ed4b5efba8159cd7864ae799a6 Mon Sep 17 00:00:00 2001 From: Greg Heartsfield Date: Thu, 22 Dec 2022 10:29:27 -0600 Subject: [PATCH] improvement: reduce logging --- src/db.rs | 5 ++++- src/server.rs | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/db.rs b/src/db.rs index 5519abd..19b2636 100644 --- a/src/db.rs +++ b/src/db.rs @@ -715,7 +715,10 @@ pub async fn db_query( let mut row_count: usize = 0; // generate SQL query let (q, p) = query_from_sub(&sub); - debug!("SQL generated in {:?}", start.elapsed()); + let sql_gen_elapsed = start.elapsed(); + if sql_gen_elapsed > Duration::from_millis(10) { + debug!("SQL (slow) generated in {:?}", start.elapsed()); + } // show pool stats log_pool_stats("reader", &pool); // cutoff for displaying slow queries diff --git a/src/server.rs b/src/server.rs index 6a2b581..644566c 100644 --- a/src/server.rs +++ b/src/server.rs @@ -248,10 +248,10 @@ pub fn start_server(settings: Settings, shutdown_rx: MpscReceiver<()>) -> Result // limit concurrent SQLite blocking threads .max_blocking_threads(settings.limits.max_blocking_threads) .on_thread_start(|| { - debug!("started new thread"); + trace!("started new thread"); }) .on_thread_stop(|| { - debug!("stopping thread"); + trace!("stopping thread"); }) .build() .unwrap(); @@ -538,7 +538,7 @@ async fn nostr_server( // TODO: serialize at broadcast time, instead of // once for each consumer. if let Ok(event_str) = serde_json::to_string(&global_event) { - debug!("sub match for client: {}, sub: {:?}, event: {:?}", + trace!("sub match for client: {}, sub: {:?}, event: {:?}", cid, s, global_event.get_event_id_prefix()); // create an event response and send it