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

Commit 9c19546

Browse files
committed
Reduced the number of lines
1 parent ed41ad5 commit 9c19546

File tree

2 files changed

+6
-22
lines changed

2 files changed

+6
-22
lines changed

src/ChannelManagers/RedisChannelManager.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,9 @@ public function subscribeToChannel(ConnectionInterface $connection, string $chan
162162

163163
$this->addConnectionToSet($connection, Carbon::now());
164164

165-
$this->addChannelToSet(
166-
$connection->app->id, $channelName
167-
);
165+
$this->addChannelToSet($connection->app->id, $channelName);
168166

169-
$this->incrementSubscriptionsCount(
170-
$connection->app->id, $channelName, 1
171-
);
167+
$this->incrementSubscriptionsCount($connection->app->id, $channelName, 1);
172168

173169
parent::subscribeToChannel($connection, $channelName, $payload);
174170
}

src/Statistics/Collectors/RedisCollector.php

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,7 @@ public function __construct()
5656
public function webSocketMessage($appId)
5757
{
5858
$this->ensureAppIsInSet($appId)
59-
->hincrby(
60-
$this->channelManager->getRedisKey($appId, null, ['stats']),
61-
'websocket_messages_count', 1
62-
);
59+
->hincrby($this->channelManager->getRedisKey($appId, null, ['stats']), 'websocket_messages_count', 1);
6360
}
6461

6562
/**
@@ -71,10 +68,7 @@ public function webSocketMessage($appId)
7168
public function apiMessage($appId)
7269
{
7370
$this->ensureAppIsInSet($appId)
74-
->hincrby(
75-
$this->channelManager->getRedisKey($appId, null, ['stats']),
76-
'api_messages_count', 1
77-
);
71+
->hincrby($this->channelManager->getRedisKey($appId, null, ['stats']), 'api_messages_count', 1);
7872
}
7973

8074
/**
@@ -127,18 +121,12 @@ public function disconnection($appId)
127121
{
128122
// Decrement the current connections count by 1.
129123
$this->ensureAppIsInSet($appId)
130-
->hincrby(
131-
$this->channelManager->getRedisKey($appId, null, ['stats']),
132-
'current_connections_count', -1
133-
)
124+
->hincrby($this->channelManager->getRedisKey($appId, null, ['stats']), 'current_connections_count', -1)
134125
->then(function ($currentConnectionsCount) use ($appId) {
135126
// Get the peak connections count from Redis.
136127
$this->channelManager
137128
->getPublishClient()
138-
->hget(
139-
$this->channelManager->getRedisKey($appId, null, ['stats']),
140-
'peak_connections_count'
141-
)
129+
->hget($this->channelManager->getRedisKey($appId, null, ['stats']), 'peak_connections_count')
142130
->then(function ($currentPeakConnectionCount) use ($currentConnectionsCount, $appId) {
143131
// Extract the greatest number between the current peak connection count
144132
// and the current connection number.

0 commit comments

Comments
 (0)