Skip to content

Commit 252d84b

Browse files
georgeh0Gohlub
authored andcommitted
fix: wire timeout with batching executor (cocoindex-io#1284)
1 parent f0311bf commit 252d84b

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

rust/cocoindex/src/ops/factory_bases.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,10 @@ pub trait BatchedFunctionExecutor: Send + Sync + Sized + 'static {
377377
None
378378
}
379379

380+
fn timeout(&self) -> Option<std::time::Duration> {
381+
None
382+
}
383+
380384
fn into_fn_executor(self) -> impl SimpleFunctionExecutor {
381385
BatchedFunctionExecutorWrapper::new(self)
382386
}
@@ -403,16 +407,19 @@ struct BatchedFunctionExecutorWrapper<E: BatchedFunctionExecutor> {
403407
batcher: batching::Batcher<BatchedFunctionExecutorRunner<E>>,
404408
enable_cache: bool,
405409
behavior_version: Option<u32>,
410+
timeout: Option<std::time::Duration>,
406411
}
407412

408413
impl<E: BatchedFunctionExecutor> BatchedFunctionExecutorWrapper<E> {
409414
fn new(executor: E) -> Self {
410415
let batching_options = executor.batching_options();
411416
let enable_cache = executor.enable_cache();
412417
let behavior_version = executor.behavior_version();
418+
let timeout = executor.timeout();
413419
Self {
414420
enable_cache,
415421
behavior_version,
422+
timeout,
416423
batcher: batching::Batcher::new(
417424
BatchedFunctionExecutorRunner(executor),
418425
batching_options,
@@ -433,6 +440,9 @@ impl<E: BatchedFunctionExecutor> SimpleFunctionExecutor for BatchedFunctionExecu
433440
fn behavior_version(&self) -> Option<u32> {
434441
self.behavior_version
435442
}
443+
fn timeout(&self) -> Option<std::time::Duration> {
444+
self.timeout
445+
}
436446
}
437447

438448
////////////////////////////////////////////////////////

rust/cocoindex/src/ops/py_factory.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@ impl BatchedFunctionExecutor for PyBatchedFunctionExecutor {
176176
fn behavior_version(&self) -> Option<u32> {
177177
self.behavior_version
178178
}
179+
fn timeout(&self) -> Option<std::time::Duration> {
180+
self.timeout
181+
}
179182
fn batching_options(&self) -> batching::BatchingOptions {
180183
self.batching_options.clone()
181184
}

0 commit comments

Comments
 (0)