From 593c48f8c2d57d322f335065acd201be2fe0183b Mon Sep 17 00:00:00 2001 From: Alex Renoki Date: Sat, 5 Sep 2020 22:41:02 +0300 Subject: [PATCH] Fixed statistics logger --- src/Statistics/Logger/RedisStatisticsLogger.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Statistics/Logger/RedisStatisticsLogger.php b/src/Statistics/Logger/RedisStatisticsLogger.php index 48118ec..b376567 100644 --- a/src/Statistics/Logger/RedisStatisticsLogger.php +++ b/src/Statistics/Logger/RedisStatisticsLogger.php @@ -86,13 +86,13 @@ class RedisStatisticsLogger implements StatisticsLogger $incremented = $this->ensureAppIsSet($appId) ->__call('hincrby', [$this->getHash($appId), 'current_connection_count', 1]); - $incremented->then(function ($currentConnectionCount) { + $incremented->then(function ($currentConnectionCount) use ($appId) { // Get the peak connections count from Redis. $peakConnectionCount = $this->replicator ->getPublishClient() ->__call('hget', [$this->getHash($appId), 'peak_connection_count']); - $peakConnectionCount->then(function ($currentPeakConnectionCount) use ($currentConnectionCount) { + $peakConnectionCount->then(function ($currentPeakConnectionCount) use ($currentConnectionCount, $appId) { // Extract the greatest number between the current peak connection count // and the current connection number. @@ -120,13 +120,13 @@ class RedisStatisticsLogger implements StatisticsLogger $decremented = $this->ensureAppIsSet($appId) ->__call('hincrby', [$this->getHash($appId), 'current_connection_count', -1]); - $decremented->then(function ($currentConnectionCount) { + $decremented->then(function ($currentConnectionCount) use ($appId) { // Get the peak connections count from Redis. $peakConnectionCount = $this->replicator ->getPublishClient() ->__call('hget', [$this->getHash($appId), 'peak_connection_count']); - $peakConnectionCount->then(function ($currentPeakConnectionCount) use ($currentConnectionCount) { + $peakConnectionCount->then(function ($currentPeakConnectionCount) use ($currentConnectionCount, $appId) { // Extract the greatest number between the current peak connection count // and the current connection number.