From fe84f2648b87588ed0270d55ac1c0c3521632ea5 Mon Sep 17 00:00:00 2001 From: Kerollmops Date: Mon, 10 Oct 2022 17:01:49 +0200 Subject: [PATCH] Allow a user to disable the auto batching system --- index-scheduler/src/batch.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/index-scheduler/src/batch.rs b/index-scheduler/src/batch.rs index 9f8e26ed1..1f9fbdcd4 100644 --- a/index-scheduler/src/batch.rs +++ b/index-scheduler/src/batch.rs @@ -397,8 +397,16 @@ impl IndexScheduler { let _index = self.get_index(rtxn, index_name)? & enqueued; + // If the autobatching is disabled we only take one task at a time. + let tasks_limit = if self.autobatching_enabled { + usize::MAX + } else { + 1 + }; + let enqueued = enqueued .into_iter() + .take(tasks_limit) .map(|task_id| { self.get_task(rtxn, task_id) .and_then(|task| task.ok_or(Error::CorruptedTaskQueue))