Merge pull request #9055 from appwrite/PLA-1990

fix(realtime): decrement connectionCounter only if connection is known
This commit is contained in:
Christy Jacob 2024-12-12 18:06:32 +04:00 committed by GitHub
commit 9a693ecfb5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -678,11 +678,10 @@ $server->onMessage(function (int $connection, string $message) use ($server, $re
$server->onClose(function (int $connection) use ($realtime, $stats, $register) {
if (array_key_exists($connection, $realtime->connections)) {
$stats->decr($realtime->connections[$connection]['projectId'], 'connectionsTotal');
$register->get('telemetry.connectionCounter')->add(-1);
}
$realtime->unsubscribe($connection);
$register->get('telemetry.connectionCounter')->add(-1);
Console::info('Connection close: ' . $connection);
});