Skip to content

Commit

Permalink
Merge pull request #78 from neighborhoods/hotfix-watchdog-to-use-one-…
Browse files Browse the repository at this point in the history
…named-connection

HOTFIX | Modify watchdog to use one named redis connection
  • Loading branch information
mucha55 committed Sep 18, 2019
2 parents 9e086bd + e08e0f1 commit 4e2b543
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/Process/Listener/Mutex/Redis.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/Process/Listener/Mutex/Redis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
public: false

0 comments on commit 4e2b543

Please sign in to comment.