Prevent multiple attaches on socket close for the same user
This commit is contained in:
parent
b0f2abad8b
commit
6919498234
@ -9,7 +9,7 @@ import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
const ROLE_MODERATOR = Meteor.settings.public.user.role_moderator;
|
||||
|
||||
function currentUser() {
|
||||
function currentUser(registerCallback) {
|
||||
if (!this.userId) {
|
||||
return Users.find({ meetingId: '' });
|
||||
}
|
||||
@ -27,7 +27,9 @@ function currentUser() {
|
||||
}
|
||||
});
|
||||
|
||||
this._session.socket.on('close', _.debounce(onCloseConnection, 100));
|
||||
if (registerCallback) {
|
||||
this._session.socket.on('close', _.debounce(onCloseConnection, 100));
|
||||
}
|
||||
|
||||
const selector = {
|
||||
meetingId,
|
||||
|
@ -229,9 +229,11 @@ class Auth {
|
||||
return;
|
||||
}
|
||||
|
||||
let registerCallback = true;
|
||||
|
||||
Tracker.autorun((c) => {
|
||||
computation = c;
|
||||
Meteor.subscribe('current-user');
|
||||
Meteor.subscribe('current-user', registerCallback);
|
||||
|
||||
const selector = { meetingId: this.meetingID, userId: this.userID };
|
||||
const fields = {
|
||||
@ -242,7 +244,7 @@ class Auth {
|
||||
if (!User || !('intId' in User)) {
|
||||
logger.info({ logCode: 'auth_service_resend_validateauthtoken' }, 're-send validateAuthToken for delayed authentication');
|
||||
makeCall('validateAuthToken', this.meetingID, this.userID, this.token);
|
||||
|
||||
registerCallback = false;
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user