From d365cf478c693aa119633b52157c25a81b7a236f Mon Sep 17 00:00:00 2001 From: zwang28 <84491488@qq.com> Date: Sun, 8 Sep 2024 11:04:02 +0800 Subject: [PATCH] fix(udf): add dedicated runtime for udf client creation --- src/expr/impl/src/udf/external.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/expr/impl/src/udf/external.rs b/src/expr/impl/src/udf/external.rs index 0d6ba0e409386..a98e8b5c705dd 100644 --- a/src/expr/impl/src/udf/external.rs +++ b/src/expr/impl/src/udf/external.rs @@ -183,6 +183,13 @@ fn get_or_create_flight_client(link: &str) -> Result> { .expect("failed to build udf runtime") }); // create new client + static RUNTIME: LazyLock = LazyLock::new(|| { + tokio::runtime::Builder::new_multi_thread() + .thread_name("rw-udf-client") + .enable_all() + .build() + .expect("failed to build rw-udf-client runtime") + }); let client = Arc::new(tokio::task::block_in_place(|| { RUNTIME.block_on(async { let channel = connect_tonic(link).await?;