Skip to content

Commit

Permalink
do not log healthcheck messages, use tokio sleep instead of std sleep
Browse files Browse the repository at this point in the history
Signed-off-by: Lance-Drane <[email protected]>
  • Loading branch information
Lance-Drane committed Aug 15, 2024
1 parent 4f7cb13 commit 30f827e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
7 changes: 2 additions & 5 deletions broker-2-http/src/webapp.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//! src/startup.rs
// see: https://github.com/tokio-rs/axum/blob/main/examples/sqlx-postgres/src/main.rs

use axum::{routing::get, serve::Serve, Router};
use secrecy::Secret;
use std::sync::Arc;
Expand Down Expand Up @@ -97,11 +94,11 @@ async fn run(
});

let app = Router::new()
.route("/healthcheck", get(health_check))
.route("/subscribe", get(sse_handler))
//.route("/publish", post(publish))
.layer(middleware)
.layer(middleware) // routes added before this layer will be logged, after this layer will not be logged
.with_state(app_state)
.route("/healthcheck", get(health_check))
.fallback(handler_404);

let server = axum::serve(listener, app);
Expand Down
2 changes: 1 addition & 1 deletion shared-deps/src/protocols/amqp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub async fn get_connection(connection_details: &BrokerSettings, retries: u32) -
}
}
tracing::error!("trying to connect after error");
std::thread::sleep(Duration::from_millis(2000));
tokio::time::sleep(Duration::from_millis(2000)).await;
res = Connection::open(&OpenConnectionArguments::new(
&connection_details.host,
connection_details.port,
Expand Down

0 comments on commit 30f827e

Please sign in to comment.