mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Use correct publisher in schedule tasks
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user