1
0
Fork 0
mirror of synced 2024-06-02 02:44:47 +12:00

Merge pull request #1606 from TorstenDittmann/fix-realtime-memory-leak

fix(realtime): memory leak with swoole table
This commit is contained in:
Torsten Dittmann 2021-09-09 11:00:42 +02:00 committed by GitHub
commit 65c13677f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -110,8 +110,8 @@ $server->onStart(function () use ($stats, $register, $containerId, &$documentId)
continue;
}
$connections = $value['connections'];
$messages = $value['messages'];
$connections = $stats->get($projectId, 'connections');
$messages = $stats->get($projectId, 'messages');
$usage = new Event('v1-usage', 'UsageV1');
$usage
@ -129,11 +129,13 @@ $server->onStart(function () use ($stats, $register, $containerId, &$documentId)
if (App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled') {
$usage->trigger();
}
unset($usage, $connections, $messages);
}
$payload = [];
foreach ($stats as $projectId => $value) {
if (!empty($value['connectionsTotal'])) {
$payload[$projectId] = $value['connectionsTotal'];
$payload[$projectId] = $stats->get($projectId, 'connectionsTotal');
}
}
if (empty($payload)) {
@ -210,7 +212,7 @@ $server->onWorkerStart(function (int $workerId) use ($server, $register, $stats,
$event = [
'project' => 'console',
'roles' => ['team:' . $value['teamId']],
'roles' => ['team:' . $stats->get($projectId, 'teamId')],
'data' => [
'event' => 'stats.connections',
'channels' => ['project'],