rename task to Interval

This commit is contained in:
Hemachandar
2025-12-23 16:32:43 +05:30
parent cf90653deb
commit 47ea2893c3
8 changed files with 25 additions and 24 deletions
+2 -2
View File
@@ -5,7 +5,7 @@ namespace Appwrite\Platform\Services;
use Appwrite\Platform\Tasks\Doctor;
use Appwrite\Platform\Tasks\Install;
use Appwrite\Platform\Tasks\Maintenance;
use Appwrite\Platform\Tasks\MaintenanceRules;
use Appwrite\Platform\Tasks\Interval;
use Appwrite\Platform\Tasks\Migrate;
use Appwrite\Platform\Tasks\QueueRetry;
use Appwrite\Platform\Tasks\ScheduleExecutions;
@@ -29,8 +29,8 @@ class Tasks extends Service
$this
->addAction(Doctor::getName(), new Doctor())
->addAction(Install::getName(), new Install())
->addAction(Interval::getName(), new Interval())
->addAction(Maintenance::getName(), new Maintenance())
->addAction(MaintenanceRules::getName(), new MaintenanceRules())
->addAction(Migrate::getName(), new Migrate())
->addAction(QueueRetry::getName(), new QueueRetry())
->addAction(SDKs::getName(), new SDKs())
@@ -12,17 +12,17 @@ use Utopia\Database\Query;
use Utopia\Platform\Action;
use Utopia\System\System;
class MaintenanceRules extends Action
class Interval extends Action
{
public static function getName(): string
{
return 'maintenance-rules';
return 'interval';
}
public function __construct()
{
$this
->desc('Schedules periodic tasks for rule verification and certificate renewal')
->desc('Schedules tasks on regular intervals by publishing them to our queues')
->inject('dbForPlatform')
->inject('queueForCertificates')
->callback($this->action(...));
@@ -30,22 +30,22 @@ class MaintenanceRules extends Action
public function action(Database $dbForPlatform, Certificate $queueForCertificates): void
{
Console::title('Rule maintenance V1');
Console::success(APP_NAME . ' rule maintenance process v1 has started');
Console::title('Interval V1');
Console::success(APP_NAME . ' interval process v1 has started');
$intervalRuleDomainVerification = (int) System::getEnv('_APP_MAINTENANCE_RULE_DOMAIN_VERIFICATION_INTERVAL', '60'); // 1 minute
$intervalRuleCertificateRenewal = (int) System::getEnv('_APP_MAINTENANCE_RULE_CERTIFICATE_RENEWAL_INTERVAL', '86400'); // 1 day
$intervalDomainVerification = (int) System::getEnv('_APP_INTERVAL_DOMAIN_VERIFICATION', '60'); // 1 minute
$intervalCertificateRenewal = (int) System::getEnv('_APP_INTERVAL_CERTIFICATE_RENEWAL', '86400'); // 1 day
\go(function () use ($dbForPlatform, $queueForCertificates, $intervalRuleDomainVerification) {
\go(function () use ($dbForPlatform, $queueForCertificates, $intervalDomainVerification) {
Console::loop(function () use ($dbForPlatform, $queueForCertificates) {
$this->verifyDomain($dbForPlatform, $queueForCertificates);
}, $intervalRuleDomainVerification);
}, $intervalDomainVerification);
});
\go(function () use ($dbForPlatform, $queueForCertificates, $intervalRuleCertificateRenewal) {
\go(function () use ($dbForPlatform, $queueForCertificates, $intervalCertificateRenewal) {
Console::loop(function () use ($dbForPlatform, $queueForCertificates) {
$this->renewCertificates($dbForPlatform, $queueForCertificates);
}, $intervalRuleCertificateRenewal);
}, $intervalCertificateRenewal);
});
}
@@ -264,6 +264,7 @@ class Certificates extends Action
// Rule not found (or) not in the expected state
if ($rule->isEmpty() || $rule->getAttribute('status') !== RULE_STATUS_CERTIFICATE_GENERATING) {
Console::warning('Certificate generation for ' . $domain->get() . ' is skipped as the associated rule is either empty or not in the expected state.');
return;
}
// Get associated certificate for the rule