diff --git a/app/controllers/api/health.php b/app/controllers/api/health.php index 975db909c6..fb084fddb3 100644 --- a/app/controllers/api/health.php +++ b/app/controllers/api/health.php @@ -556,12 +556,12 @@ App::get('/v1/health/queue/deletes') contentType: ContentType::JSON )) ->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true) - ->inject('publisher') + ->inject('publisherDeletes') ->inject('response') - ->action(function (int|string $threshold, Publisher $publisher, Response $response) { + ->action(function (int|string $threshold, Publisher $publisherDeletes, Response $response) { $threshold = \intval($threshold); - $size = $publisher->getQueueSize(new Queue(Event::DELETE_QUEUE_NAME)); + $size = $publisherDeletes->getQueueSize(new Queue(Event::DELETE_QUEUE_NAME)); if ($size >= $threshold) { throw new Exception(Exception::HEALTH_QUEUE_SIZE_EXCEEDED, "Queue size threshold hit. Current size is {$size} and threshold is {$threshold}."); @@ -589,12 +589,12 @@ App::get('/v1/health/queue/mails') contentType: ContentType::JSON )) ->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true) - ->inject('publisher') + ->inject('publisherMails') ->inject('response') - ->action(function (int|string $threshold, Publisher $publisher, Response $response) { + ->action(function (int|string $threshold, Publisher $publisherMails, Response $response) { $threshold = \intval($threshold); - $size = $publisher->getQueueSize(new Queue(Event::MAILS_QUEUE_NAME)); + $size = $publisherMails->getQueueSize(new Queue(Event::MAILS_QUEUE_NAME)); if ($size >= $threshold) { throw new Exception(Exception::HEALTH_QUEUE_SIZE_EXCEEDED, "Queue size threshold hit. Current size is {$size} and threshold is {$threshold}."); @@ -622,12 +622,12 @@ App::get('/v1/health/queue/messaging') contentType: ContentType::JSON )) ->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true) - ->inject('publisher') + ->inject('publisherMessaging') ->inject('response') - ->action(function (int|string $threshold, Publisher $publisher, Response $response) { + ->action(function (int|string $threshold, Publisher $publisherMessaging, Response $response) { $threshold = \intval($threshold); - $size = $publisher->getQueueSize(new Queue(Event::MESSAGING_QUEUE_NAME)); + $size = $publisherMessaging->getQueueSize(new Queue(Event::MESSAGING_QUEUE_NAME)); if ($size >= $threshold) { throw new Exception(Exception::HEALTH_QUEUE_SIZE_EXCEEDED, "Queue size threshold hit. Current size is {$size} and threshold is {$threshold}."); diff --git a/app/init/resources.php b/app/init/resources.php index 9ae132d30c..9a91e50491 100644 --- a/app/init/resources.php +++ b/app/init/resources.php @@ -96,20 +96,14 @@ App::setResource('publisherMigrations', function (BrokerPool $publisher) { App::setResource('publisherStatsUsage', function (BrokerPool $publisher) { return $publisher; }, ['publisher']); -App::setResource('consumer', function (Group $pools) { - return new BrokerPool(consumer: $pools->get('consumer')); -}, ['pools']); -App::setResource('consumerDatabases', function (BrokerPool $consumer) { - return $consumer; -}, ['consumer']); -App::setResource('consumerFunctions', function (BrokerPool $consumer) { - return $consumer; -}, ['consumer']); -App::setResource('consumerMigrations', function (BrokerPool $consumer) { - return $consumer; +App::setResource('publisherMails', function (BrokerPool $publisher) { + return $publisher; }, ['publisher']); -App::setResource('consumerStatsUsage', function (BrokerPool $consumer) { - return $consumer; +App::setResource('publisherDeletes', function (BrokerPool $publisher) { + return $publisher; +}, ['publisher']); +App::setResource('publisherMessaging', function (BrokerPool $publisher) { + return $publisher; }, ['publisher']); App::setResource('queueForMessaging', function (Publisher $publisher) { return new Messaging($publisher);