8000 remove superflous Arc from get_tokio_runtime · apache/datafusion-python@efd2046 · GitHub
[go: up one dir, main page]

Skip to content

Commit efd2046

Browse files
remove superflous Arc from get_tokio_runtime
1 parent 030ec20 commit efd2046

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/utils.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,17 @@ use crate::TokioRuntime;
2020
use datafusion::logical_expr::Volatility;
2121
use pyo3::prelude::*;
2222
use std::future::Future;
23-
use std::sync::{Arc, OnceLock};
23+
use std::sync::OnceLock;
2424
use tokio::runtime::Runtime;
2525

2626
/// Utility to get the Tokio Runtime from Python
27-
pub(crate) fn get_tokio_runtime() -> Arc<TokioRuntime> {
28-
static RUNTIME: OnceLock<Arc<TokioRuntime>> = OnceLock::new();
27+
pub(crate) fn get_tokio_runtime() -> &'static TokioRuntime {
28+
static RUNTIME: OnceLock<TokioRuntime> = OnceLock::new();
2929
RUNTIME
3030
.get_or_init(|| {
3131
let rt = TokioRuntime(tokio::runtime::Runtime::new().unwrap());
32-
Arc::new(rt)
32+
rt
3333
})
34-
.clone()
3534
}
3635

3736
/// Utility to collect rust futures with GIL released

0 commit comments

Comments
 (0)
0