Skip to content

Commit 48e4f7c

Browse files
committed
remove unused get_and_enter_tokio_runtime function and simplify wait_for_future
1 parent d5cf16d commit 48e4f7c

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

src/utils.rs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ use pyo3::types::PyCapsule;
2727
use std::future::Future;
2828
use std::sync::OnceLock;
2929
use std::time::Duration;
30-
use tokio::runtime::Runtime;
3130

3231
/// Utility to get the Tokio Runtime from Python
3332
#[inline]
@@ -48,23 +47,13 @@ pub(crate) fn get_global_ctx() -> &'static SessionContext {
4847
CTX.get_or_init(SessionContext::new)
4948
}
5049

51-
/// Gets the Tokio runtime with time enabled and enters it, returning both the runtime and enter guard
52-
/// This helps ensure that we don't forget to call enter() after getting the runtime
53-
#[inline]
54-
pub(crate) fn get_and_enter_tokio_runtime(
55-
) -> (&'static Runtime, tokio::runtime::EnterGuard<'static>) {
56-
let runtime = &get_tokio_runtime().0;
57-
let enter_guard = runtime.enter();
58-
(runtime, enter_guard)
59-
}
60-
6150
/// Utility to collect rust futures with GIL released and interrupt support
6251
pub fn wait_for_future<F>(py: Python, f: F) -> PyResult<F::Output>
6352
where
6453
F: Future + Send + 'static,
6554
F::Output: Send + 'static,
6655
{
67-
let (runtime, _enter_guard) = get_and_enter_tokio_runtime();
56+
let runtime = &get_tokio_runtime().0;
6857
// Define the milisecond interval for checking Python signals
6958
const SIGNAL_CHECK_INTERVAL: Duration = Duration::from_millis(1_000);
7059

0 commit comments

Comments
 (0)