Allow a user to disable the auto batching system

This commit is contained in:
Kerollmops 2022-10-10 17:01:49 +02:00 committed by Clément Renault
parent e2a766acb5
commit fe84f2648b
No known key found for this signature in database
GPG Key ID: 92ADA4E935E71FA4

View File

@ -397,8 +397,16 @@ impl IndexScheduler {
let _index = self.get_index(rtxn, index_name)? & enqueued; 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 let enqueued = enqueued
.into_iter() .into_iter()
.take(tasks_limit)
.map(|task_id| { .map(|task_id| {
self.get_task(rtxn, task_id) self.get_task(rtxn, task_id)
.and_then(|task| task.ok_or(Error::CorruptedTaskQueue)) .and_then(|task| task.ok_or(Error::CorruptedTaskQueue))