1
0
Fork 0
mirror of synced 2024-09-20 03:17:30 +12:00

fix(realtime): unsubscribe before resubscribing on permission change

Unsubcribe to remove subscriptions related to the old permissions.
This commit is contained in:
Steven Nguyen 2024-07-19 00:06:14 +00:00 committed by GitHub
parent 5aa944ee82
commit 80769a0b65
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -380,8 +380,10 @@ $server->onWorkerStart(function (int $workerId) use ($server, $register, $stats,
$user = $database->getDocument('users', $userId);
$roles = Auth::getRoles($user);
$channels = $realtime->connections[$connection]['channels'];
$realtime->subscribe($projectId, $connection, $roles, $realtime->connections[$connection]['channels']);
$realtime->unsubscribe($connection);
$realtime->subscribe($projectId, $connection, $roles, $channels);
$register->get('pools')->reclaim();
}