From ee8e7333d848c6c17d07b11774ee9b40aeca0b68 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Wed, 17 Dec 2025 14:19:04 +0000 Subject: [PATCH] fix: sync updated schedules --- src/Appwrite/Platform/Tasks/ScheduleBase.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Appwrite/Platform/Tasks/ScheduleBase.php b/src/Appwrite/Platform/Tasks/ScheduleBase.php index 8ea673703a..9698fe9034 100644 --- a/src/Appwrite/Platform/Tasks/ScheduleBase.php +++ b/src/Appwrite/Platform/Tasks/ScheduleBase.php @@ -123,6 +123,7 @@ abstract class ScheduleBase extends Action $total = 0; $latestDocument = null; $updatedProjectIds = []; // Track project IDs from updated/new schedules + $updatedSequences = []; // Track sequences that need project/resource loading while ($sum === $limit) { $paginationQueries = [Query::limit($limit)]; @@ -186,8 +187,9 @@ abstract class ScheduleBase extends Action Console::info("Updating: {$candidate['resourceType']}::{$candidate['resourceId']}"); $this->schedules[$schedule->getSequence()] = $candidate; - // Track projectId for updated/new schedules + // Track projectId and sequence for updated/new schedules $updatedProjectIds[] = $candidate['projectId']; + $updatedSequences[] = $schedule->getSequence(); } } @@ -239,7 +241,13 @@ abstract class ScheduleBase extends Action Console::success("No new projects to load (using " . count($map) . " cached projects)"); } - foreach ($this->schedules as $sequence => $schedule) { + // Only process updated/new schedules, not all schedules + foreach ($updatedSequences as $sequence) { + $schedule = $this->schedules[$sequence] ?? null; + if ($schedule === null) { + continue; + } + $project = $map[$schedule['projectId']] ?? null; if ($project === null || $project->isEmpty()) {