8000 Fix cross-project scheduler stability by Meldiron · Pull Request #8641 · appwrite/appwrite · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix cross-project scheduler stability #8641

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
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
7 changes: 4 additions & 3 deletions src/Appwrite/Platform/Tasks/ScheduleBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/Appwrite/Platform/Tasks/ScheduleExecutions.php
B6F8
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/Appwrite/Platform/Tasks/ScheduleMessages.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ protected function enqueueResources(Group $pools, Database $dbForConsole): void

$queue->reclaim();

unset($this->schedules[$schedule['resourceId']]);
unset($this->schedules[$schedule['$internalId']]);
});
}
}
Expand Down
Loading
0