From 626946b7b786659c985acf3b76ad98c8547acb5e Mon Sep 17 00:00:00 2001 From: _ <_@_> Date: Wed, 16 Dec 2020 19:06:15 -0600 Subject: [PATCH] :sound: update: demote some boring logs from debug to trace --- crates/ptth_relay/src/lib.rs | 15 ++++++++++----- crates/ptth_relay/src/server_endpoint.rs | 10 +++++----- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/crates/ptth_relay/src/lib.rs b/crates/ptth_relay/src/lib.rs index f3c0057..d3fcaf9 100644 --- a/crates/ptth_relay/src/lib.rs +++ b/crates/ptth_relay/src/lib.rs @@ -141,7 +141,7 @@ async fn handle_http_request ( // disconnects right as we're sending this. // Then what? - debug! ( + trace! ( "Sending request {} directly to server {}", req_id, watcher_code, @@ -395,12 +395,17 @@ async fn reload_config ( config_reload_path: &Path ) -> Result <(), ConfigError> { let new_config = Config::from_file (config_reload_path).await?; - let mut config = state.config.write ().await; - (*config) = new_config; - debug! ("Loaded {} server configs", config.servers.len ()); - debug! ("enable_scraper_api: {}", config.iso.enable_scraper_api); + trace! ("Reloading config"); + if config.servers.len () != new_config.servers.len () { + debug! ("Loaded {} server configs", config.servers.len ()); + } + if config.iso.enable_scraper_api != new_config.iso.enable_scraper_api { + debug! ("enable_scraper_api: {}", config.iso.enable_scraper_api); + } + + (*config) = new_config; if config.iso.dev_mode.is_some () { error! ("Dev mode is enabled! This might turn off some security features. If you see this in production, escalate it to someone!"); diff --git a/crates/ptth_relay/src/server_endpoint.rs b/crates/ptth_relay/src/server_endpoint.rs index f907552..a5df0f3 100644 --- a/crates/ptth_relay/src/server_endpoint.rs +++ b/crates/ptth_relay/src/server_endpoint.rs @@ -100,7 +100,7 @@ pub async fn handle_listen ( } } - debug! ("Parking server {}", watcher_code); + trace! ("Parking server {}", watcher_code); request_rendezvous.insert (watcher_code.clone (), ParkedServer (tx)); } @@ -109,14 +109,14 @@ pub async fn handle_listen ( futures::select! { x = rx.fuse () => match x { Ok (Ok (one_req)) => { - debug! ("Unparking server {}", watcher_code); + trace! ("Unparking server {}", watcher_code); Ok (ok_reply (rmp_serde::to_vec (&vec! [one_req])?)?) }, Ok (Err (ShuttingDownError::ShuttingDown)) => Ok (error_reply (StatusCode::SERVICE_UNAVAILABLE, "Server is shutting down, try again soon")?), Err (_) => Ok (error_reply (StatusCode::INTERNAL_SERVER_ERROR, "Server error")?), }, _ = delay_for (Duration::from_secs (30)).fuse () => { - debug! ("Timed out http_listen for server {}", watcher_code); + trace! ("Timed out http_listen for server {}", watcher_code); return Ok (error_reply (StatusCode::NO_CONTENT, "No requests now, long-poll again")?) } } @@ -178,7 +178,7 @@ pub async fn handle_response ( } } else { - debug! ("Finished relaying bytes"); + trace! ("Finished relaying bytes"); body_finished_tx.send (StreamFinished).map_err (|_| LostServer)?; break; } @@ -213,7 +213,7 @@ pub async fn handle_response ( relay_task.await??; - debug! ("Connected server to client for streaming."); + trace! ("Connected server to client for streaming."); match body_finished_rx.await { Ok (StreamFinished) => { Ok (error_reply (StatusCode::OK, "StreamFinished")?)