stop adding one enqueued tasks to all unprioritized batches

This commit is contained in:
Tamo 2024-12-04 15:43:05 +01:00
parent cbcf6c9ba3
commit cb0c3a5aad
No known key found for this signature in database
GPG Key ID: 20CD8020AFA88D69
2 changed files with 5 additions and 6 deletions

View File

@ -496,8 +496,7 @@ impl IndexScheduler {
// 5. We make a batch from the unprioritised tasks. Start by taking the next enqueued task. // 5. We make a batch from the unprioritised tasks. Start by taking the next enqueued task.
let task_id = if let Some(task_id) = enqueued.min() { task_id } else { return Ok(None) }; let task_id = if let Some(task_id) = enqueued.min() { task_id } else { return Ok(None) };
let mut task = self.get_task(rtxn, task_id)?.ok_or(Error::CorruptedTaskQueue)?; let task = self.get_task(rtxn, task_id)?.ok_or(Error::CorruptedTaskQueue)?;
current_batch.processing(Some(&mut task));
// If the task is not associated with any index, verify that it is an index swap and // If the task is not associated with any index, verify that it is an index swap and
// create the batch directly. Otherwise, get the index name associated with the task // create the batch directly. Otherwise, get the index name associated with the task

View File

@ -4333,15 +4333,15 @@ mod tests {
"primaryKey": "mouse" "primaryKey": "mouse"
}, },
"stats": { "stats": {
"totalNbTasks": 2, "totalNbTasks": 1,
"status": { "status": {
"processing": 2 "processing": 1
}, },
"types": { "types": {
"indexCreation": 2 "indexCreation": 1
}, },
"indexUids": { "indexUids": {
"catto": 2 "catto": 1
} }
}, },
"startedAt": "1970-01-01T00:00:00Z", "startedAt": "1970-01-01T00:00:00Z",