fix(realtime): memory leak with swoole table
This commit is contained in:
parent
7e1a03effd
commit
1200ced449
1 changed files with 6 additions and 4 deletions
|
@ -110,8 +110,8 @@ $server->onStart(function () use ($stats, $register, $containerId, &$documentId)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$connections = $value['connections'];
|
$connections = $stats->get($projectId, 'connections');
|
||||||
$messages = $value['messages'];
|
$messages = $stats->get($projectId, 'messages');
|
||||||
|
|
||||||
$usage = new Event('v1-usage', 'UsageV1');
|
$usage = new Event('v1-usage', 'UsageV1');
|
||||||
$usage
|
$usage
|
||||||
|
@ -129,11 +129,13 @@ $server->onStart(function () use ($stats, $register, $containerId, &$documentId)
|
||||||
if (App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled') {
|
if (App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled') {
|
||||||
$usage->trigger();
|
$usage->trigger();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unset($usage, $connections, $messages);
|
||||||
}
|
}
|
||||||
$payload = [];
|
$payload = [];
|
||||||
foreach ($stats as $projectId => $value) {
|
foreach ($stats as $projectId => $value) {
|
||||||
if (!empty($value['connectionsTotal'])) {
|
if (!empty($value['connectionsTotal'])) {
|
||||||
$payload[$projectId] = $value['connectionsTotal'];
|
$payload[$projectId] = $stats->get($projectId, 'connectionsTotal');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (empty($payload)) {
|
if (empty($payload)) {
|
||||||
|
@ -210,7 +212,7 @@ $server->onWorkerStart(function (int $workerId) use ($server, $register, $stats,
|
||||||
|
|
||||||
$event = [
|
$event = [
|
||||||
'project' => 'console',
|
'project' => 'console',
|
||||||
'roles' => ['team:' . $value['teamId']],
|
'roles' => ['team:' . $stats->get($projectId, 'teamId')],
|
||||||
'data' => [
|
'data' => [
|
||||||
'event' => 'stats.connections',
|
'event' => 'stats.connections',
|
||||||
'channels' => ['project'],
|
'channels' => ['project'],
|
||||||
|
|
Loading…
Reference in a new issue