fix(realtime): disable sending realtime stats
Disable sending realtime stats because the $database->find('realtime') is throwing: > Cannot execute queries while other unbuffered queries are active. In addition, the realtime stats are not being collected so there's no point in having this enabled.
This commit is contained in:
parent
8562823b07
commit
fa78ae078f
1 changed files with 41 additions and 41 deletions
|
@ -268,54 +268,54 @@ $server->onWorkerStart(function (int $workerId) use ($server, $register, $stats,
|
||||||
/**
|
/**
|
||||||
* Sending current connections to project channels on the console project every 5 seconds.
|
* Sending current connections to project channels on the console project every 5 seconds.
|
||||||
*/
|
*/
|
||||||
if ($realtime->hasSubscriber('console', Role::users()->toString(), 'project')) {
|
// if ($realtime->hasSubscriber('console', Role::users()->toString(), 'project')) {
|
||||||
$database = getConsoleDB();
|
// $database = getConsoleDB();
|
||||||
|
|
||||||
$payload = [];
|
// $payload = [];
|
||||||
|
|
||||||
$list = Authorization::skip(fn () => $database->find('realtime', [
|
// $list = Authorization::skip(fn () => $database->find('realtime', [
|
||||||
Query::greaterThan('timestamp', DateTime::addSeconds(new \DateTime(), -15)),
|
// Query::greaterThan('timestamp', DateTime::addSeconds(new \DateTime(), -15)),
|
||||||
]));
|
// ]));
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* Aggregate stats across containers.
|
// * Aggregate stats across containers.
|
||||||
*/
|
// */
|
||||||
foreach ($list as $document) {
|
// foreach ($list as $document) {
|
||||||
foreach (json_decode($document->getAttribute('value')) as $projectId => $value) {
|
// foreach (json_decode($document->getAttribute('value')) as $projectId => $value) {
|
||||||
if (array_key_exists($projectId, $payload)) {
|
// if (array_key_exists($projectId, $payload)) {
|
||||||
$payload[$projectId] += $value;
|
// $payload[$projectId] += $value;
|
||||||
} else {
|
// } else {
|
||||||
$payload[$projectId] = $value;
|
// $payload[$projectId] = $value;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
foreach ($stats as $projectId => $value) {
|
// foreach ($stats as $projectId => $value) {
|
||||||
if (!array_key_exists($projectId, $payload)) {
|
// if (!array_key_exists($projectId, $payload)) {
|
||||||
continue;
|
// continue;
|
||||||
}
|
// }
|
||||||
|
|
||||||
$event = [
|
// $event = [
|
||||||
'project' => 'console',
|
// 'project' => 'console',
|
||||||
'roles' => ['team:' . $stats->get($projectId, 'teamId')],
|
// 'roles' => ['team:' . $stats->get($projectId, 'teamId')],
|
||||||
'data' => [
|
// 'data' => [
|
||||||
'events' => ['stats.connections'],
|
// 'events' => ['stats.connections'],
|
||||||
'channels' => ['project'],
|
// 'channels' => ['project'],
|
||||||
'timestamp' => DateTime::formatTz(DateTime::now()),
|
// 'timestamp' => DateTime::formatTz(DateTime::now()),
|
||||||
'payload' => [
|
// 'payload' => [
|
||||||
$projectId => $payload[$projectId]
|
// $projectId => $payload[$projectId]
|
||||||
]
|
// ]
|
||||||
]
|
// ]
|
||||||
];
|
// ];
|
||||||
|
|
||||||
$server->send($realtime->getSubscribers($event), json_encode([
|
// $server->send($realtime->getSubscribers($event), json_encode([
|
||||||
'type' => 'event',
|
// 'type' => 'event',
|
||||||
'data' => $event['data']
|
// 'data' => $event['data']
|
||||||
]));
|
// ]));
|
||||||
}
|
// }
|
||||||
|
|
||||||
$register->get('pools')->reclaim();
|
// $register->get('pools')->reclaim();
|
||||||
}
|
// }
|
||||||
/**
|
/**
|
||||||
* Sending test message for SDK E2E tests every 5 seconds.
|
* Sending test message for SDK E2E tests every 5 seconds.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue