From 498b0b1419b5d902c43af1f4739aa8e6ff9299ad Mon Sep 17 00:00:00 2001 From: Mubelotix Date: Wed, 6 Aug 2025 12:33:53 +0200 Subject: [PATCH] Optimization --- crates/index-scheduler/src/queue/tasks.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/index-scheduler/src/queue/tasks.rs b/crates/index-scheduler/src/queue/tasks.rs index 74192232e..3ce4665c7 100644 --- a/crates/index-scheduler/src/queue/tasks.rs +++ b/crates/index-scheduler/src/queue/tasks.rs @@ -383,7 +383,11 @@ impl Queue { // tasks that are not processing. The non-processing ones are filtered normally while the processing ones // are entirely removed unless the in-memory startedAt variable falls within the date filter. // Once we have filtered the two subsets, we put them back together and assign it back to `tasks`. - tasks = { + tasks = 'started_at: { + if after_started_at.is_none() && before_started_at.is_none() { + break 'started_at tasks; + } + let (mut filtered_non_processing_tasks, mut filtered_processing_tasks) = (&tasks - &**processing_tasks, &tasks & &**processing_tasks);