prevents client freeze on race condition when customUserSettings set
This commit is contained in:
parent
b58f1953f0
commit
73e9b6d70f
@ -25,6 +25,7 @@ class JoinHandler extends Component {
|
||||
super(props);
|
||||
this.fetchToken = this.fetchToken.bind(this);
|
||||
this.changeToJoin = this.changeToJoin.bind(this);
|
||||
this.numFetchTokenRetries = 0;
|
||||
|
||||
this.state = {
|
||||
joined: false,
|
||||
@ -40,6 +41,19 @@ class JoinHandler extends Component {
|
||||
}
|
||||
|
||||
async fetchToken() {
|
||||
if (!Meteor.status().connected) {
|
||||
if (this.numFetchTokenRetries > 9) {
|
||||
logger.error({
|
||||
logCode: 'joinhandler_component_joinroutehandler_error',
|
||||
extraInfo: {
|
||||
numFetchTokenRetries: this.numFetchTokenRetries,
|
||||
},
|
||||
}, 'Meteor was not connected, retry in a few moments');
|
||||
}
|
||||
this.numFetchTokenRetries += 1;
|
||||
|
||||
setTimeout(() => this.fetchToken(), 200);
|
||||
}
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const sessionToken = urlParams.get('sessionToken');
|
||||
|
||||
@ -102,7 +116,6 @@ class JoinHandler extends Component {
|
||||
meetingID, internalUserID, customdata,
|
||||
} = resp;
|
||||
|
||||
|
||||
return new Promise((resolve) => {
|
||||
if (customdata.length) {
|
||||
makeCall('addUserSettings', meetingID, internalUserID, customdata).then(r => resolve(r));
|
||||
|
@ -11,12 +11,12 @@ import { notify } from '/imports/ui/services/notification';
|
||||
* @return {Promise}
|
||||
*/
|
||||
export function makeCall(name, ...args) {
|
||||
if (Meteor.status().connected) {
|
||||
check(name, String);
|
||||
check(name, String);
|
||||
|
||||
const { credentials } = Auth;
|
||||
const { credentials } = Auth;
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (Meteor.status().connected) {
|
||||
Meteor.call(name, credentials, ...args, (error, result) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
@ -24,9 +24,10 @@ export function makeCall(name, ...args) {
|
||||
|
||||
resolve(result);
|
||||
});
|
||||
});
|
||||
}
|
||||
return null;
|
||||
} else {
|
||||
reject(new Error('Meteor was not connected'));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user