From bf7e6cf0a0129e3407d6712395fdefcb709d7b2e Mon Sep 17 00:00:00 2001 From: ZhenYi <434836402@qq.com> Date: Mon, 11 May 2026 00:43:36 +0800 Subject: [PATCH] fix(app): initialize tracing immediately and fix replica timeout units - Change init_tracing_subscriber defer=false so logs appear before DB connection fails (was deferred when OTEL enabled, producing no output) - Fix replica connection pool timeouts from from_millis to from_secs (write connection was fixed earlier but replica was missed) --- apps/app/src/main.rs | 2 +- libs/db/database.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/app/src/main.rs b/apps/app/src/main.rs index 485776b..7eb053c 100644 --- a/apps/app/src/main.rs +++ b/apps/app/src/main.rs @@ -134,7 +134,7 @@ async fn main() -> anyhow::Result<()> { let cfg = AppConfig::load(); let log_level = cfg.log_level().unwrap_or_else(|_| "info".to_string()); let otel_enabled = cfg.otel_enabled().unwrap_or(false); - init_tracing_subscriber(&log_level, otel_enabled); + init_tracing_subscriber(&log_level, false); tracing::info!( app_name = %cfg.app_name().unwrap_or_default(), app_version = %cfg.app_version().unwrap_or_default(), diff --git a/libs/db/database.rs b/libs/db/database.rs index 5c36e91..de4faf4 100644 --- a/libs/db/database.rs +++ b/libs/db/database.rs @@ -39,9 +39,9 @@ impl AppDatabase { let conn_cfg = sea_orm::ConnectOptions::new(replica_url.clone()) .max_connections(max_connections) .min_connections(min_connections) - .idle_timeout(Duration::from_millis(idle_timeout)) - .max_lifetime(Duration::from_millis(max_lifetime)) - .connect_timeout(Duration::from_millis(connection_timeout)) + .idle_timeout(Duration::from_secs(idle_timeout)) + .max_lifetime(Duration::from_secs(max_lifetime)) + .connect_timeout(Duration::from_secs(connection_timeout)) .to_owned(); Some(Database::connect(conn_cfg).await?) } else {