From 263ca4ed115a216d4d29fce47e942b4049944be4 Mon Sep 17 00:00:00 2001 From: "Rodrigo Rodriguez (Pragmatismo)" Date: Fri, 3 Apr 2026 09:26:23 -0300 Subject: [PATCH] fix: use new_current_thread runtime in get_database_url_sync to prevent nested block_on panic --- src/core/shared/utils.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/core/shared/utils.rs b/src/core/shared/utils.rs index f6c42940..9d93a06b 100644 --- a/src/core/shared/utils.rs +++ b/src/core/shared/utils.rs @@ -54,7 +54,13 @@ pub fn get_database_url_sync() -> Result { let guard = SECRETS_MANAGER.read().map_err(|e| anyhow::anyhow!("Lock poisoned: {}", e))?; if let Some(ref manager) = *guard { if let Ok(handle) = tokio::runtime::Handle::try_current() { - return handle.block_on(manager.get_database_url()); + return tokio::task::block_in_place(|| { + let rt = tokio::runtime::Builder::new_current_thread() + .enable_all() + .build() + .map_err(|e| anyhow::anyhow!("Failed to create runtime: {}", e))?; + rt.block_on(manager.get_database_url()) + }); } else { let rt = tokio::runtime::Runtime::new() .map_err(|e| anyhow::anyhow!("Failed to create runtime: {}", e))?;