diff --git a/src/Appwrite/Platform/Tasks/ScheduleBase.php b/src/Appwrite/Platform/Tasks/ScheduleBase.php index be0abc4b662..e013220aa4d 100644 --- a/src/Appwrite/Platform/Tasks/ScheduleBase.php +++ b/src/Appwrite/Platform/Tasks/ScheduleBase.php @@ -74,6 +74,7 @@ public function action(Group $pools, Database $dbForConsole, callable $getProjec ); return [ + '$internalId' => $schedule->getInternalId(), '$id' => $schedule->getId(), 'resourceId' => $schedule->getAttribute('resourceId'), 'schedule' => $schedule->getAttribute('schedule'), @@ -110,7 +111,7 @@ public function action(Group $pools, Database $dbForConsole, callable $getProjec 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 @@ public function action(Group $pools, Database $dbForConsole, callable $getProjec 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 c5f9b40d152..0e618642d52 100644 --- a/src/Appwrite/Platform/Tasks/ScheduleExecutions.php +++ b/src/Appwrite/Platform/Tasks/ScheduleExecutions.php @@ -36,7 +36,7 @@ protected function enqueueResources(Group $pools, Database $dbForConsole): void $schedule['$id'], ); - unset($this->schedules[$schedule['resourceId']]); + unset($this->schedules[$schedule['$internalId']]); continue; } @@ -70,7 +70,7 @@ protected function enqueueResources(Group $pools, Database $dbForConsole): void $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 145b6ee9766..167f1282edc 100644 --- a/src/Appwrite/Platform/Tasks/ScheduleMessages.php +++ b/src/Appwrite/Platform/Tasks/ScheduleMessages.php @@ -53,7 +53,7 @@ protected function enqueueResources(Group $pools, Database $dbForConsole): void $queue->reclaim(); - unset($this->schedules[$schedule['resourceId']]); + unset($this->schedules[$schedule['$internalId']]); }); } }