From e2bd3e922e58cea0612bdb3513bdbbd700312fca Mon Sep 17 00:00:00 2001 From: Jiangzhou He Date: Wed, 12 Nov 2025 09:17:03 -0800 Subject: [PATCH] fix: wire timeout with batching executor --- rust/cocoindex/src/ops/factory_bases.rs | 10 ++++++++++ rust/cocoindex/src/ops/py_factory.rs | 3 +++ 2 files changed, 13 insertions(+) diff --git a/rust/cocoindex/src/ops/factory_bases.rs b/rust/cocoindex/src/ops/factory_bases.rs index ec9857f3..3b028a53 100644 --- a/rust/cocoindex/src/ops/factory_bases.rs +++ b/rust/cocoindex/src/ops/factory_bases.rs @@ -377,6 +377,10 @@ pub trait BatchedFunctionExecutor: Send + Sync + Sized + 'static { None } + fn timeout(&self) -> Option { + None + } + fn into_fn_executor(self) -> impl SimpleFunctionExecutor { BatchedFunctionExecutorWrapper::new(self) } @@ -403,6 +407,7 @@ struct BatchedFunctionExecutorWrapper { batcher: batching::Batcher>, enable_cache: bool, behavior_version: Option, + timeout: Option, } impl BatchedFunctionExecutorWrapper { @@ -410,9 +415,11 @@ impl BatchedFunctionExecutorWrapper { let batching_options = executor.batching_options(); let enable_cache = executor.enable_cache(); let behavior_version = executor.behavior_version(); + let timeout = executor.timeout(); Self { enable_cache, behavior_version, + timeout, batcher: batching::Batcher::new( BatchedFunctionExecutorRunner(executor), batching_options, @@ -433,6 +440,9 @@ impl SimpleFunctionExecutor for BatchedFunctionExecu fn behavior_version(&self) -> Option { self.behavior_version } + fn timeout(&self) -> Option { + self.timeout + } } //////////////////////////////////////////////////////// diff --git a/rust/cocoindex/src/ops/py_factory.rs b/rust/cocoindex/src/ops/py_factory.rs index 584b760b..94ad4c88 100644 --- a/rust/cocoindex/src/ops/py_factory.rs +++ b/rust/cocoindex/src/ops/py_factory.rs @@ -175,6 +175,9 @@ impl BatchedFunctionExecutor for PyBatchedFunctionExecutor { fn behavior_version(&self) -> Option { self.behavior_version } + fn timeout(&self) -> Option { + self.timeout + } fn batching_options(&self) -> batching::BatchingOptions { self.batching_options.clone() }