mirror of
https://github.com/appwrite/appwrite
synced 2026-05-22 16:38:32 +00:00
Set publisher on base
This commit is contained in:
parent
f7296d80b2
commit
43fb92ca83
3 changed files with 7 additions and 7 deletions
|
|
@ -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.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue