From e89973f1bf01c8a687275116205abf9d869df104 Mon Sep 17 00:00:00 2001 From: Kerollmops Date: Wed, 18 Jan 2023 15:25:27 +0100 Subject: [PATCH] Do not delete all tasks when no canceled-by matches --- index-scheduler/src/lib.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/index-scheduler/src/lib.rs b/index-scheduler/src/lib.rs index 0b9e856d2..4374a0612 100644 --- a/index-scheduler/src/lib.rs +++ b/index-scheduler/src/lib.rs @@ -502,13 +502,22 @@ impl IndexScheduler { } if let Some(canceled_by) = &query.canceled_by { + let mut all_canceled_tasks = RoaringBitmap::new(); for cancel_task_uid in canceled_by { if let Some(canceled_by_uid) = self.canceled_by.get(rtxn, &BEU32::new(*cancel_task_uid))? { - tasks &= canceled_by_uid; + all_canceled_tasks |= canceled_by_uid; } } + + // if the canceled_by has been specified but no task + // matches then we prefer matching zero than all tasks. + if all_canceled_tasks.is_empty() { + return Ok(RoaringBitmap::new()); + } else { + tasks &= all_canceled_tasks; + } } if let Some(kind) = &query.types {