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)
This commit is contained in:
parent
fc013b174f
commit
bf7e6cf0a0
@ -134,7 +134,7 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
let cfg = AppConfig::load();
|
let cfg = AppConfig::load();
|
||||||
let log_level = cfg.log_level().unwrap_or_else(|_| "info".to_string());
|
let log_level = cfg.log_level().unwrap_or_else(|_| "info".to_string());
|
||||||
let otel_enabled = cfg.otel_enabled().unwrap_or(false);
|
let otel_enabled = cfg.otel_enabled().unwrap_or(false);
|
||||||
init_tracing_subscriber(&log_level, otel_enabled);
|
init_tracing_subscriber(&log_level, false);
|
||||||
tracing::info!(
|
tracing::info!(
|
||||||
app_name = %cfg.app_name().unwrap_or_default(),
|
app_name = %cfg.app_name().unwrap_or_default(),
|
||||||
app_version = %cfg.app_version().unwrap_or_default(),
|
app_version = %cfg.app_version().unwrap_or_default(),
|
||||||
|
|||||||
@ -39,9 +39,9 @@ impl AppDatabase {
|
|||||||
let conn_cfg = sea_orm::ConnectOptions::new(replica_url.clone())
|
let conn_cfg = sea_orm::ConnectOptions::new(replica_url.clone())
|
||||||
.max_connections(max_connections)
|
.max_connections(max_connections)
|
||||||
.min_connections(min_connections)
|
.min_connections(min_connections)
|
||||||
.idle_timeout(Duration::from_millis(idle_timeout))
|
.idle_timeout(Duration::from_secs(idle_timeout))
|
||||||
.max_lifetime(Duration::from_millis(max_lifetime))
|
.max_lifetime(Duration::from_secs(max_lifetime))
|
||||||
.connect_timeout(Duration::from_millis(connection_timeout))
|
.connect_timeout(Duration::from_secs(connection_timeout))
|
||||||
.to_owned();
|
.to_owned();
|
||||||
Some(Database::connect(conn_cfg).await?)
|
Some(Database::connect(conn_cfg).await?)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user