diff --git a/crates/index-scheduler/src/queue/batches.rs b/crates/index-scheduler/src/queue/batches.rs index 67c3f71fc..970e41110 100644 --- a/crates/index-scheduler/src/queue/batches.rs +++ b/crates/index-scheduler/src/queue/batches.rs @@ -245,7 +245,7 @@ impl BatchQueue { wtxn, self.enqueued_at, old_batch.started_at, - if old_batch.stats.total_nb_tasks >= 2 { 2 } else { 1 }, + old_batch.stats.total_nb_tasks.clamp(1, 2) as usize, old_batch.uid, )?; } diff --git a/crates/index-scheduler/src/scheduler/process_batch.rs b/crates/index-scheduler/src/scheduler/process_batch.rs index c374044f5..623bdeb53 100644 --- a/crates/index-scheduler/src/scheduler/process_batch.rs +++ b/crates/index-scheduler/src/scheduler/process_batch.rs @@ -538,7 +538,7 @@ impl IndexScheduler { wtxn, self.queue.batches.enqueued_at, batch.started_at, - if batch.stats.total_nb_tasks >= 2 { 2 } else { 1 }, + batch.stats.total_nb_tasks.clamp(1, 2) as usize, batch_id, )?; }