[bugfix] fix runtime dropping panic in editable (#7628)

This commit is contained in:
Simo Lin
2025-06-29 15:38:28 -07:00
committed by GitHub
parent b3cff3651e
commit e3f9b54819

View File

@@ -272,7 +272,12 @@ impl Router {
.unwrap_or_else(|| "127.0.0.1".to_string()), .unwrap_or_else(|| "127.0.0.1".to_string()),
}); });
actix_web::rt::System::new().block_on(async move { // Use tokio runtime instead of actix-web System for better compatibility
let runtime = tokio::runtime::Runtime::new()
.map_err(|e| pyo3::exceptions::PyRuntimeError::new_err(e.to_string()))?;
// Block on the async startup function
runtime.block_on(async move {
server::startup(server::ServerConfig { server::startup(server::ServerConfig {
host: self.host.clone(), host: self.host.clone(),
port: self.port, port: self.port,
@@ -286,8 +291,7 @@ impl Router {
request_timeout_secs: self.request_timeout_secs, request_timeout_secs: self.request_timeout_secs,
}) })
.await .await
.map_err(|e| pyo3::exceptions::PyRuntimeError::new_err(e.to_string()))?; .map_err(|e| pyo3::exceptions::PyRuntimeError::new_err(e.to_string()))
Ok(())
}) })
} }
} }