Unverified Commit e3f9b548 authored by Simo Lin's avatar Simo Lin Committed by GitHub
Browse files

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

parent b3cff365
...@@ -272,7 +272,12 @@ impl Router { ...@@ -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 { ...@@ -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(())
}) })
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment