From e08e0f13f698d72bb2c8df9e4f7c36e9d70e6c4c Mon Sep 17 00:00:00 2001 From: mucha55 Date: Tue, 17 Sep 2019 18:05:38 -0500 Subject: [PATCH] Modify watchdog to use one named redis connection --- src/Process/Listener/Mutex/Redis.php | 7 ++++--- src/Process/Listener/Mutex/Redis.yml | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Process/Listener/Mutex/Redis.php b/src/Process/Listener/Mutex/Redis.php index c329bd66..d4621515 100644 --- a/src/Process/Listener/Mutex/Redis.php +++ b/src/Process/Listener/Mutex/Redis.php @@ -3,17 +3,18 @@ namespace Neighborhoods\Kojo\Process\Listener\Mutex; +use Neighborhoods\Kojo\Message\Broker\BrokerInterface; use Neighborhoods\Kojo\Process\Forked; use Neighborhoods\Kojo\Process\ListenerAbstract; use Neighborhoods\Kojo\Process\ListenerInterface; use Neighborhoods\Kojo\ProcessInterface; -use Neighborhoods\Kojo\Redis\Factory; +use Neighborhoods\Kojo\Redis\Repository; use RuntimeException; use Throwable; class Redis extends ListenerAbstract implements RedisInterface { - use Factory\AwareTrait; + use Repository\AwareTrait; public const PROP_REDIS = 'redis'; protected function _run(): Forked @@ -56,7 +57,7 @@ public function hasMessages(): bool protected function _getRedis(): \Redis { if (!$this->_exists(self::PROP_REDIS)) { - $this->_create(self::PROP_REDIS, $this->_getRedisFactory()->create()); + $this->_create(self::PROP_REDIS, $this->_getRedisRepository()->getById(BrokerInterface::class)); } return $this->_read(self::PROP_REDIS); diff --git a/src/Process/Listener/Mutex/Redis.yml b/src/Process/Listener/Mutex/Redis.yml index b087a8e9..fcf7e16c 100644 --- a/src/Process/Listener/Mutex/Redis.yml +++ b/src/Process/Listener/Mutex/Redis.yml @@ -12,8 +12,8 @@ services: - [setBrokerTypeCollection, ['@neighborhoods.kojo.message.broker.type.collection-job']] - [setBrokerTypeCode, ['process.listener.mutex.redis']] - [setProcessPoolFactory, ['@process.pool.factory-empty']] - - [setRedisFactory, ['@redis.factory']] + - [setRedisRepository, ['@redis.repository']] - [setTitlePrefix, ['%process.title.prefix%']] process.listener.mutex.redis: alias: neighborhoods.kojo.process.listener.mutex.redis - public: false \ No newline at end of file + public: false