Set publisher on base

This commit is contained in:
Jake Barnby 2025-04-30 13:04:19 +12:00
parent f7296d80b2
commit 43fb92ca83
No known key found for this signature in database
GPG key ID: C437A8CC85B96E9C
3 changed files with 7 additions and 7 deletions

View file

@ -12,6 +12,7 @@ use Utopia\Database\Query;
use Utopia\Database\Validator\Authorization;
use Utopia\Platform\Action;
use Utopia\Pools\Group;
use Utopia\Queue\Broker\Pool as BrokerPool;
use Utopia\System\System;
use function Swoole\Coroutine\run;
@ -23,6 +24,8 @@ abstract class ScheduleBase extends Action
protected array $schedules = [];
protected BrokerPool $publisher;
abstract public static function getName(): string;
abstract public static function getSupportedResource(): string;
abstract public static function getCollectionId(): string;
@ -61,6 +64,8 @@ abstract class ScheduleBase extends Action
Console::title(\ucfirst(static::getSupportedResource()) . ' scheduler V1');
Console::success(APP_NAME . ' ' . \ucfirst(static::getSupportedResource()) . ' scheduler v1 has started');
$this->publisher = new BrokerPool($pools->get('publisher'));
/**
* Extract only necessary attributes to lower memory used.
*

View file

@ -5,7 +5,6 @@ namespace Appwrite\Platform\Tasks;
use Appwrite\Event\Func;
use Utopia\Database\Database;
use Utopia\Pools\Group;
use Utopia\Queue\Broker\Pool as BrokerPool;
class ScheduleExecutions extends ScheduleBase
{
@ -59,9 +58,7 @@ class ScheduleExecutions extends ScheduleBase
\go(function () use ($schedule, $delay, $data, $pools) {
\Co::sleep($delay);
$publisher = new BrokerPool($pools->get('publisher'));
$queueForFunctions = new Func($publisher);
$queueForFunctions = new Func($this->publisher);
$queueForFunctions->setType('schedule')
// Set functionId instead of function as we don't have $dbForProject

View file

@ -42,9 +42,7 @@ class ScheduleMessages extends ScheduleBase
}
\go(function () use ($schedule, $pools, $dbForPlatform) {
$publisher = new BrokerPool($pools->get('publisher'));
$queueForMessaging = new Messaging($publisher);
$queueForMessaging = new Messaging($this->publisher);
$this->updateProjectAccess($schedule['project'], $dbForPlatform);