mirror of
https://github.com/appwrite/appwrite
synced 2026-05-22 16:38:32 +00:00
Merge pull request #9238 from appwrite/fix-maintenance-job
fix: maintenance job missing type
This commit is contained in:
commit
d21d18fe18
1 changed files with 5 additions and 12 deletions
|
|
@ -47,9 +47,12 @@ class Maintenance extends Action
|
|||
Console::info("[{$time}] Notifying workers with maintenance tasks every {$interval} seconds");
|
||||
|
||||
$this->foreachProject($dbForPlatform, function (Document $project) use ($queueForDeletes, $usageStatsRetentionHourly) {
|
||||
$queueForDeletes->setProject($project);
|
||||
$queueForDeletes
|
||||
->setType(DELETE_TYPE_MAINTENANCE)
|
||||
->setProject($project)
|
||||
->setUsageRetentionHourlyDateTime(DateTime::addSeconds(new \DateTime(), -1 * $usageStatsRetentionHourly))
|
||||
->trigger();
|
||||
|
||||
$this->notifyProjects($queueForDeletes, $usageStatsRetentionHourly);
|
||||
});
|
||||
|
||||
$this->notifyDeleteConnections($queueForDeletes);
|
||||
|
|
@ -59,16 +62,6 @@ class Maintenance extends Action
|
|||
}, $interval, $delay);
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook to allow sub-classes to extend project-level maintenance functionality.
|
||||
*/
|
||||
protected function notifyProjects(Delete $queueForDeletes, int $usageStatsRetentionHourly): void
|
||||
{
|
||||
$queueForDeletes
|
||||
->setUsageRetentionHourlyDateTime(DateTime::addSeconds(new \DateTime(), -1 * $usageStatsRetentionHourly))
|
||||
->trigger();
|
||||
}
|
||||
|
||||
protected function foreachProject(Database $dbForPlatform, callable $callback): void
|
||||
{
|
||||
// TODO: @Meldiron name of this method no longer matches. It does not delete, and it gives whole document
|
||||
|
|
|
|||
Loading…
Reference in a new issue