diff --git a/src/Appwrite/Platform/Tasks/ScheduleBase.php b/src/Appwrite/Platform/Tasks/ScheduleBase.php index be0abc4b66..e013220aa4 100644 --- a/src/Appwrite/Platform/Tasks/ScheduleBase.php +++ b/src/Appwrite/Platform/Tasks/ScheduleBase.php @@ -74,6 +74,7 @@ abstract class ScheduleBase extends Action ); return [ + '$internalId' => $schedule->getInternalId(), '$id' => $schedule->getId(), 'resourceId' => $schedule->getAttribute('resourceId'), 'schedule' => $schedule->getAttribute('schedule'), @@ -110,7 +111,7 @@ abstract class ScheduleBase extends Action foreach ($results as $document) { try { - $this->schedules[$document['resourceId']] = $getSchedule($document); + $this->schedules[$document->getInternalId()] = $getSchedule($document); } catch (\Throwable $th) { $collectionId = match ($document->getAttribute('resourceType')) { 'function' => 'functions', @@ -172,10 +173,10 @@ abstract class ScheduleBase extends Action if (!$document['active']) { Console::info("Removing: {$document['resourceId']}"); - unset($this->schedules[$document['resourceId']]); + unset($this->schedules[$document->getInternalId()]); } elseif ($new !== $org) { Console::info("Updating: {$document['resourceId']}"); - $this->schedules[$document['resourceId']] = $getSchedule($document); + $this->schedules[$document->getInternalId()] = $getSchedule($document); } } diff --git a/src/Appwrite/Platform/Tasks/ScheduleExecutions.php b/src/Appwrite/Platform/Tasks/ScheduleExecutions.php index c5f9b40d15..0e618642d5 100644 --- a/src/Appwrite/Platform/Tasks/ScheduleExecutions.php +++ b/src/Appwrite/Platform/Tasks/ScheduleExecutions.php @@ -36,7 +36,7 @@ class ScheduleExecutions extends ScheduleBase $schedule['$id'], ); - unset($this->schedules[$schedule['resourceId']]); + unset($this->schedules[$schedule['$internalId']]); continue; } @@ -70,7 +70,7 @@ class ScheduleExecutions extends ScheduleBase $schedule['$id'], ); - unset($this->schedules[$schedule['resourceId']]); + unset($this->schedules[$schedule['$internalId']]); } $queue->reclaim(); diff --git a/src/Appwrite/Platform/Tasks/ScheduleMessages.php b/src/Appwrite/Platform/Tasks/ScheduleMessages.php index 145b6ee976..167f1282ed 100644 --- a/src/Appwrite/Platform/Tasks/ScheduleMessages.php +++ b/src/Appwrite/Platform/Tasks/ScheduleMessages.php @@ -53,7 +53,7 @@ class ScheduleMessages extends ScheduleBase $queue->reclaim(); - unset($this->schedules[$schedule['resourceId']]); + unset($this->schedules[$schedule['$internalId']]); }); } }