From b7ba98a6a6675281ae9e4f6b746c575a8bc92530 Mon Sep 17 00:00:00 2001 From: Alex Renoki Date: Thu, 17 Sep 2020 10:51:01 +0300 Subject: [PATCH] Enforce topic subscription --- src/ChannelManagers/RedisChannelManager.php | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/ChannelManagers/RedisChannelManager.php b/src/ChannelManagers/RedisChannelManager.php index ac8847f..f914b2c 100644 --- a/src/ChannelManagers/RedisChannelManager.php +++ b/src/ChannelManagers/RedisChannelManager.php @@ -158,12 +158,7 @@ class RedisChannelManager extends LocalChannelManager */ public function subscribeToChannel(ConnectionInterface $connection, string $channelName, stdClass $payload) { - $this->getGlobalConnectionsCount($connection->app->id, $channelName) - ->then(function ($count) use ($connection, $channelName) { - if ($count === 0) { - $this->subscribeToTopic($connection->app->id, $channelName); - } - }); + $this->subscribeToTopic($connection->app->id, $channelName); $this->addConnectionToSet($connection); @@ -753,13 +748,13 @@ class RedisChannelManager extends LocalChannelManager $hash = "{$prefix}{$appId}"; if ($channel) { - $hash .= ":{$channel}"; + $suffixes = array_merge([$channel], $suffixes); } - $suffixes = join(':', $suffixes); + $suffixes = implode(':', $suffixes); if ($suffixes) { - $hash .= $suffixes; + $hash .= ":{$suffixes}"; } return $hash;