Skip to content
Snippets Groups Projects
Unverified Commit 4a1e43cc authored by Anton Georgiev's avatar Anton Georgiev Committed by GitHub
Browse files

Merge pull request #12695 from antobinary/user-left

fix: removeUser - handle connections in frontends, db changes in backend
parents b04863ff b5851aa1
No related branches found
No related tags found
No related merge requests found
......@@ -8,7 +8,9 @@ export default function clearAuthTokenValidation(meetingId) {
Logger.info(`Error when removing auth-token-validation for meeting=${meetingId}`);
}
ClientConnections.removeMeeting(meetingId);
if (!process.env.BBB_HTML5_ROLE || process.env.BBB_HTML5_ROLE === 'frontend') {
ClientConnections.removeMeeting(meetingId);
}
Logger.info(`Cleared AuthTokenValidation (${meetingId})`);
});
}
......@@ -18,45 +18,39 @@ export default function removeUser(meetingId, userId) {
check(meetingId, String);
check(userId, String);
const userToRemove = Users.findOne({ userId, meetingId });
if (userToRemove) {
const { presenter } = userToRemove;
if (presenter) {
stopWatchingExternalVideoSystemCall({ meetingId, requesterUserId: 'system-presenter-was-removed' });
try {
if (!process.env.BBB_HTML5_ROLE || process.env.BBB_HTML5_ROLE === 'frontend') {
const sessionUserId = `${meetingId}-${userId}`;
ClientConnections.removeClientConnection(`${meetingId}--${userId}`);
clearAllSessions(sessionUserId);
// we don't want to fully process the redis message in frontend
// since the backend is supposed to update Mongo
if (process.env.BBB_HTML5_ROLE === 'frontend') {
return;
}
}
}
const selector = {
meetingId,
userId,
};
const selector = {
meetingId,
userId,
};
try {
setloggedOutStatus(userId, meetingId, true);
VideoStreams.remove({ meetingId, userId });
const sessionUserId = `${meetingId}-${userId}`;
const userToRemove = Users.findOne({ userId, meetingId });
ClientConnections.removeClientConnection(`${meetingId}--${userId}`);
if (userToRemove) {
const { presenter } = userToRemove;
if (presenter) {
stopWatchingExternalVideoSystemCall({ meetingId, requesterUserId: 'system-presenter-was-removed' });
}
}
clearAllSessions(sessionUserId);
setloggedOutStatus(userId, meetingId, true);
VideoStreams.remove({ meetingId, userId });
clearUserInfoForRequester(meetingId, userId);
/*
Timeout added to reduce the probability that "userRemove" happens too close to "ejectUser",
redirecting user to the wrong component.
This is a workaround and should be removed as soon as a better fix is made
see: https://github.com/bigbluebutton/bigbluebutton/pull/12057
*/
const DELAY_USER_REMOVAL_TIMEOUT_MS = 1000;
Meteor.wrapAsync((callback) => {
Meteor.setTimeout(() => {
Users.remove(selector);
callback();
}, DELAY_USER_REMOVAL_TIMEOUT_MS);
})();
Users.remove(selector);
Logger.info(`Removed user id=${userId} meeting=${meetingId}`);
} catch (err) {
......
......@@ -171,6 +171,10 @@ class ClientConnections {
}
const ClientConnectionsSingleton = new ClientConnections();
if (!process.env.BBB_HTML5_ROLE || process.env.BBB_HTML5_ROLE === 'frontend') {
Logger.info("ClientConnectionsSingleton was created")
export default ClientConnectionsSingleton;
const ClientConnectionsSingleton = new ClientConnections();
export default ClientConnectionsSingleton;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment