mirror of
https://github.com/appwrite/appwrite
synced 2026-05-24 09:28:40 +00:00
Use correct publisher in schedule tasks
This commit is contained in:
parent
6725b31b65
commit
f224c09c10
2 changed files with 16 additions and 2 deletions
|
|
@ -6,6 +6,7 @@ use Appwrite\Event\Func;
|
||||||
use Swoole\Coroutine as Co;
|
use Swoole\Coroutine as Co;
|
||||||
use Utopia\Database\Database;
|
use Utopia\Database\Database;
|
||||||
use Utopia\Pools\Group;
|
use Utopia\Pools\Group;
|
||||||
|
use Utopia\System\System;
|
||||||
|
|
||||||
class ScheduleExecutions extends ScheduleBase
|
class ScheduleExecutions extends ScheduleBase
|
||||||
{
|
{
|
||||||
|
|
@ -29,9 +30,15 @@ class ScheduleExecutions extends ScheduleBase
|
||||||
|
|
||||||
protected function enqueueResources(Group $pools, Database $dbForPlatform, callable $getProjectDB): void
|
protected function enqueueResources(Group $pools, Database $dbForPlatform, callable $getProjectDB): void
|
||||||
{
|
{
|
||||||
$queueForFunctions = new Func($this->publisher);
|
|
||||||
$intervalEnd = (new \DateTime())->modify('+' . self::ENQUEUE_TIMER . ' seconds');
|
$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) {
|
foreach ($this->schedules as $schedule) {
|
||||||
if (!$schedule['active']) {
|
if (!$schedule['active']) {
|
||||||
$dbForPlatform->deleteDocument(
|
$dbForPlatform->deleteDocument(
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,8 @@ use Utopia\CLI\Console;
|
||||||
use Utopia\Database\Database;
|
use Utopia\Database\Database;
|
||||||
use Utopia\Database\DateTime;
|
use Utopia\Database\DateTime;
|
||||||
use Utopia\Pools\Group;
|
use Utopia\Pools\Group;
|
||||||
|
use Utopia\Queue\Queue;
|
||||||
|
use Utopia\System\System;
|
||||||
|
|
||||||
class ScheduleFunctions extends ScheduleBase
|
class ScheduleFunctions extends ScheduleBase
|
||||||
{
|
{
|
||||||
|
|
@ -90,7 +92,12 @@ class ScheduleFunctions extends ScheduleBase
|
||||||
|
|
||||||
$this->updateProjectAccess($schedule['project'], $dbForPlatform);
|
$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
|
$queueForFunctions
|
||||||
->setType('schedule')
|
->setType('schedule')
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue