Skip to content

Commit 66c7a02

Browse files
authored
Merge pull request #129 from vectorlessflow/dev
refactor(engine): use get_runtime instead of creating new Runtime
2 parents d51c85e + 4f8fe40 commit 66c7a02

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

crates/vectorless-py/src/engine.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55
66
use pyo3::exceptions::PyRuntimeError;
77
use pyo3::prelude::*;
8-
use pyo3_async_runtimes::tokio::future_into_py;
8+
use pyo3_async_runtimes::tokio::{future_into_py, get_runtime};
99
use std::sync::Arc;
10-
use tokio::runtime::Runtime;
1110

1211
use ::vectorless_engine::{Engine, EngineBuilder, IngestInput, RawNodeInput};
1312

@@ -142,9 +141,7 @@ impl PyEngine {
142141
endpoint: Option<String>,
143142
config: Option<PyRef<super::config::PyConfig>>,
144143
) -> PyResult<Self> {
145-
let rt = Runtime::new().map_err(|e| {
146-
PyRuntimeError::new_err(format!("Failed to create tokio runtime: {}", e))
147-
})?;
144+
let rt = get_runtime();
148145

149146
let rust_config = config.map(|c| c.inner.clone());
150147

0 commit comments

Comments
 (0)