diff --git a/src/Appwrite/Event/Certificate.php b/src/Appwrite/Event/Certificate.php index aab8c1400b..d323d1b970 100644 --- a/src/Appwrite/Event/Certificate.php +++ b/src/Appwrite/Event/Certificate.php @@ -9,7 +9,6 @@ class Certificate extends Event { public const ACTION_VERIFICATION = 'verification'; public const ACTION_GENERATION = 'generation'; - public const ACTION_GENERATION_SYNC = 'generation_sync'; protected bool $skipRenewCheck = false; protected ?Document $domain = null; diff --git a/src/Appwrite/Platform/Tasks/Maintenance.php b/src/Appwrite/Platform/Tasks/Maintenance.php index 9f91e531e6..bc3763dcd7 100644 --- a/src/Appwrite/Platform/Tasks/Maintenance.php +++ b/src/Appwrite/Platform/Tasks/Maintenance.php @@ -38,8 +38,7 @@ class Maintenance extends Action Console::success(APP_NAME . ' maintenance process v1 has started'); $interval = (int) System::getEnv('_APP_MAINTENANCE_INTERVAL', '86400'); // 1 day - $intervalRuleVerification = (int) System::getEnv('_APP_MAINTENANCE_INTERVAL_RULE_VERIFICATION', '120'); // 2 minutes - $intervalRuleGeneration = (int) System::getEnv('_APP_MAINTENANCE_INTERVAL_RULE_GENERATION', '60'); // 1 minute + $intervalRuleVerification = (int) System::getEnv('_APP_MAINTENANCE_INTERVAL_RULE_VERIFICATION', '60'); // 1 minute $usageStatsRetentionHourly = (int) System::getEnv('_APP_MAINTENANCE_RETENTION_USAGE_HOURLY', '8640000'); //100 days $cacheRetention = (int) System::getEnv('_APP_MAINTENANCE_RETENTION_CACHE', '2592000'); // 30 days @@ -107,12 +106,6 @@ class Maintenance extends Action $this->checkRuleVerification($dbForPlatform, $queueForCertificates); }, $intervalRuleVerification); }); - - \go(function () use ($dbForPlatform, $queueForCertificates, $intervalRuleGeneration) { - Console::loop(function () use ($dbForPlatform, $queueForCertificates) { - $this->checkRuleGeneration($dbForPlatform, $queueForCertificates); - }, $intervalRuleGeneration); - }); } private function notifyDeleteConnections(Delete $queueForDeletes): void @@ -159,42 +152,6 @@ class Maintenance extends Action } } - private function checkRuleGeneration(Database $dbForPlatform, Certificate $queueForCertificate): void - { - $time = DatabaseDateTime::now(); - - $oldestToCheck = new DateTime(); - $oldestToCheck->sub(new DateInterval('PT72H')); // -3 days - - $rules = $dbForPlatform->find('rules', [ - Query::createdAfter(DatabaseDateTime::format($oldestToCheck)), // max 3 days old - Query::equal('status', ['verifying']), // waiting for verification to finish - Query::orderAsc('$updatedAt'), // Pick the ones waiting for another attempt for longest - Query::limit(10), // Reasonable pagination limit, processable within a minute - ]); - - if (\count($rules) > 0) { - Console::info("[{$time}] Found " . \count($rules) . " rules under generation, scheduling jobs."); - - foreach ($rules as $rule) { - if ($rule->getAttribute('region') !== System::getEnv('_APP_REGION', 'default')) { - continue; - } - - $queueForCertificate - ->setDomain(new Document([ - 'domain' => $rule->getAttribute('domain'), - 'domainType' => $rule->getAttribute('deploymentResourceType', $rule->getAttribute('type')), - ])) - ->setAction(Certificate::ACTION_GENERATION_SYNC) - ->trigger(); - } - } else { - // Silenced because interval makes it too often - // Console::log("[{$time}] No rules for checking generation progress."); - } - } - private function renewCertificates(Database $dbForPlatform, Certificate $queueForCertificate): void { $time = DatabaseDateTime::now(); diff --git a/src/Appwrite/Platform/Workers/Certificates.php b/src/Appwrite/Platform/Workers/Certificates.php index 062c74c4ee..245ec2d869 100644 --- a/src/Appwrite/Platform/Workers/Certificates.php +++ b/src/Appwrite/Platform/Workers/Certificates.php @@ -113,9 +113,6 @@ class Certificates extends Action case Certificate::ACTION_VERIFICATION: $this->executeVerification($domain, $dbForPlatform, $log, $queueForCertificates, $verificationDomainFunction, $verificationDomainApi); break; - case Certificate::ACTION_GENERATION_SYNC: - $this->executeGenerationSync(); - break; default: throw new Exception('Invalid action . ' . $action); }