From 37d33565a511f1888490099902fa0c000223cddf Mon Sep 17 00:00:00 2001 From: Michael-J-Ward Date: Fri, 4 Oct 2024 13:09:11 -0500 Subject: [PATCH] remove superflous Arc from get_tokio_runtime --- src/utils.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/utils.rs b/src/utils.rs index e2ff3e29..a4345044 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -20,18 +20,17 @@ use crate::TokioRuntime; use datafusion::logical_expr::Volatility; use pyo3::prelude::*; use std::future::Future; -use std::sync::{Arc, OnceLock}; +use std::sync::OnceLock; use tokio::runtime::Runtime; /// Utility to get the Tokio Runtime from Python -pub(crate) fn get_tokio_runtime() -> Arc { - static RUNTIME: OnceLock> = OnceLock::new(); +pub(crate) fn get_tokio_runtime() -> &'static TokioRuntime { + static RUNTIME: OnceLock = OnceLock::new(); RUNTIME .get_or_init(|| { let rt = TokioRuntime(tokio::runtime::Runtime::new().unwrap()); - Arc::new(rt) + rt }) - .clone() } /// Utility to collect rust futures with GIL released