Skip to content
This repository was archived by the owner on Feb 7, 2024. It is now read-only.

Commit 8d1369e

Browse files
committed
Fixed peak connections count not being able to settle down
1 parent 19ca49a commit 8d1369e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Statistics/Collectors/RedisCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ public function resetStatistics($appId, int $currentConnectionCount)
249249

250250
$this->channelManager->getPublishClient()->hset(
251251
$this->channelManager->getRedisKey($appId, null, ['stats']),
252-
'peak_connections_count', $currentConnectionCount
252+
'peak_connections_count', max(0, $currentConnectionCount)
253253
);
254254

255255
$this->channelManager->getPublishClient()->hset(

src/Statistics/Statistic.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ public function apiMessage()
178178
public function reset(int $currentConnectionsCount)
179179
{
180180
$this->currentConnectionsCount = $currentConnectionsCount;
181-
$this->peakConnectionsCount = $currentConnectionsCount;
181+
$this->peakConnectionsCount = max(0, $currentConnectionsCount);
182182
$this->webSocketMessagesCount = 0;
183183
$this->apiMessagesCount = 0;
184184
}

0 commit comments

Comments
 (0)