mirror of
https://github.com/appwrite/appwrite
synced 2026-04-21 13:37:16 +00:00
updated
This commit is contained in:
parent
25854c84f5
commit
abd6f0add2
1 changed files with 7 additions and 0 deletions
|
|
@ -1166,6 +1166,8 @@ $server->onMessage(function (int $connection, string $message) use ($server, $re
|
|||
throw new Exception(Exception::REALTIME_MESSAGE_FORMAT_INVALID, 'Payload is not valid.');
|
||||
}
|
||||
|
||||
$subscriptionsBefore = \count($realtime->getSubscriptionMetadata($connection));
|
||||
|
||||
// Validate every payload before executing any removal so an invalid entry
|
||||
// later in the batch does not leave earlier entries half-applied on the server.
|
||||
$validatedIds = [];
|
||||
|
|
@ -1189,6 +1191,11 @@ $server->onMessage(function (int $connection, string $message) use ($server, $re
|
|||
'removed' => $wasRemoved,
|
||||
];
|
||||
}
|
||||
$subscriptionsAfter = \count($realtime->getSubscriptionMetadata($connection));
|
||||
$subscriptionDelta = $subscriptionsAfter - $subscriptionsBefore;
|
||||
if ($subscriptionDelta !== 0) {
|
||||
$register->get('telemetry.workerSubscriptionCounter')->add($subscriptionDelta, $register->get('telemetry.workerAttributes'));
|
||||
}
|
||||
|
||||
$unsubscribeResponsePayload = json_encode([
|
||||
'type' => 'response',
|
||||
|
|
|
|||
Loading…
Reference in a new issue