mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-09-06 04:36:32 +00:00
Optim N: Clone task ids instead of matched tasks
This commit is contained in:
@ -99,7 +99,7 @@ impl IndexScheduler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut deleted_tasks = self.delete_matched_tasks(matched_tasks.clone(), &progress)?;
|
let mut deleted_tasks = self.delete_matched_tasks(&matched_tasks, &progress)?;
|
||||||
|
|
||||||
for task in tasks.iter_mut() {
|
for task in tasks.iter_mut() {
|
||||||
task.status = Status::Succeeded;
|
task.status = Status::Succeeded;
|
||||||
@ -508,7 +508,7 @@ impl IndexScheduler {
|
|||||||
#[allow(clippy::reversed_empty_ranges)]
|
#[allow(clippy::reversed_empty_ranges)]
|
||||||
fn delete_matched_tasks(
|
fn delete_matched_tasks(
|
||||||
&self,
|
&self,
|
||||||
matched_tasks: RoaringBitmap,
|
matched_tasks: &RoaringBitmap,
|
||||||
progress: &Progress,
|
progress: &Progress,
|
||||||
) -> Result<RoaringBitmap> {
|
) -> Result<RoaringBitmap> {
|
||||||
/// Given a **sorted** iterator of `u32`, return an iterator of the ranges of consecutive values it contains.
|
/// Given a **sorted** iterator of `u32`, return an iterator of the ranges of consecutive values it contains.
|
||||||
@ -641,7 +641,7 @@ impl IndexScheduler {
|
|||||||
let enqueued_tasks = self.queue.tasks.get_status(&rtxn, Status::Enqueued)?;
|
let enqueued_tasks = self.queue.tasks.get_status(&rtxn, Status::Enqueued)?;
|
||||||
let processing_tasks = &self.processing_tasks.read().unwrap().processing.clone();
|
let processing_tasks = &self.processing_tasks.read().unwrap().processing.clone();
|
||||||
let all_task_ids = &self.queue.tasks.all_task_ids(&rtxn)?;
|
let all_task_ids = &self.queue.tasks.all_task_ids(&rtxn)?;
|
||||||
let mut to_delete_tasks = matched_tasks & all_task_ids;
|
let mut to_delete_tasks = all_task_ids.clone() & matched_tasks;
|
||||||
to_delete_tasks -= &**processing_tasks;
|
to_delete_tasks -= &**processing_tasks;
|
||||||
to_delete_tasks -= &enqueued_tasks;
|
to_delete_tasks -= &enqueued_tasks;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user