Use correct publisher in schedule tasks

This commit is contained in:
Jake Barnby 2025-07-03 14:08:54 -04:00
parent 6725b31b65
commit f224c09c10
No known key found for this signature in database
GPG key ID: C437A8CC85B96E9C
2 changed files with 16 additions and 2 deletions

View file

@ -6,6 +6,7 @@ use Appwrite\Event\Func;
use Swoole\Coroutine as Co;
use Utopia\Database\Database;
use Utopia\Pools\Group;
use Utopia\System\System;
class ScheduleExecutions extends ScheduleBase
{
@ -29,9 +30,15 @@ class ScheduleExecutions extends ScheduleBase
protected function enqueueResources(Group $pools, Database $dbForPlatform, callable $getProjectDB): void
{
$queueForFunctions = new Func($this->publisher);
$intervalEnd = (new \DateTime())->modify('+' . self::ENQUEUE_TIMER . ' seconds');
$isRedisFallback = \str_contains(System::getEnv('_APP_WORKER_REDIS_FALLBACK', ''), 'functions');
$queueForFunctions = new Func($isRedisFallback
? $this->publisherRedis
: $this->publisher
);
foreach ($this->schedules as $schedule) {
if (!$schedule['active']) {
$dbForPlatform->deleteDocument(

View file

@ -8,6 +8,8 @@ use Utopia\CLI\Console;
use Utopia\Database\Database;
use Utopia\Database\DateTime;
use Utopia\Pools\Group;
use Utopia\Queue\Queue;
use Utopia\System\System;
class ScheduleFunctions extends ScheduleBase
{
@ -90,7 +92,12 @@ class ScheduleFunctions extends ScheduleBase
$this->updateProjectAccess($schedule['project'], $dbForPlatform);
$queueForFunctions = new Func($this->publisher);
$isRedisFallback = \str_contains(System::getEnv('_APP_WORKER_REDIS_FALLBACK', ''), 'functions');
$queueForFunctions = new Func($isRedisFallback
? $this->publisherRedis
: $this->publisher
);
$queueForFunctions
->setType('schedule')