Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/Appwrite/Platform/Tasks/ScheduleBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ private function collectSchedules(Database $dbForPlatform, callable $getProjectD
$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)];
Expand Down Expand Up @@ -186,8 +187,9 @@ private function collectSchedules(Database $dbForPlatform, callable $getProjectD
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();
}
}

Expand Down Expand Up @@ -239,7 +241,13 @@ private function collectSchedules(Database $dbForPlatform, callable $getProjectD
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()) {
Expand Down
Loading