diff --git a/src/Statistics/Collectors/RedisCollector.php b/src/Statistics/Collectors/RedisCollector.php index 050eb74..a7bd00f 100644 --- a/src/Statistics/Collectors/RedisCollector.php +++ b/src/Statistics/Collectors/RedisCollector.php @@ -249,7 +249,7 @@ class RedisCollector extends MemoryCollector $this->channelManager->getPublishClient()->hset( $this->channelManager->getRedisKey($appId, null, ['stats']), - 'peak_connections_count', $currentConnectionCount + 'peak_connections_count', max(0, $currentConnectionCount) ); $this->channelManager->getPublishClient()->hset( diff --git a/src/Statistics/Statistic.php b/src/Statistics/Statistic.php index 1a92488..5e1f05f 100644 --- a/src/Statistics/Statistic.php +++ b/src/Statistics/Statistic.php @@ -178,7 +178,7 @@ class Statistic public function reset(int $currentConnectionsCount) { $this->currentConnectionsCount = $currentConnectionsCount; - $this->peakConnectionsCount = $currentConnectionsCount; + $this->peakConnectionsCount = max(0, $currentConnectionsCount); $this->webSocketMessagesCount = 0; $this->apiMessagesCount = 0; }