mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
- callLoginMethod is an async function now
- handle async hooks inside _callOnReconnectAndSendAppropriateOutstandingMethods
This commit is contained in:
@@ -307,7 +307,7 @@ export class AccountsClient extends AccountsCommon {
|
||||
if (this._tokenExpiresSoon(result.tokenExpires)) {
|
||||
this.makeClientLoggedOut();
|
||||
} else {
|
||||
this.callLoginMethod({
|
||||
return this.callLoginMethod({
|
||||
methodArguments: [{resume: result.token}],
|
||||
// Reconnect quiescence ensures that the user doesn't see an
|
||||
// intermediate state before the login method finishes. So we don't
|
||||
@@ -396,7 +396,7 @@ export class AccountsClient extends AccountsCommon {
|
||||
if (!options._suppressLoggingIn) {
|
||||
this._setLoggingIn(true);
|
||||
}
|
||||
this.connection.apply(
|
||||
return this.connection.applyAsync(
|
||||
options.methodName,
|
||||
options.methodArguments,
|
||||
{ wait: true, onResultReceived: onResultReceived },
|
||||
|
||||
@@ -1789,15 +1789,14 @@ export class Connection {
|
||||
if (msg.offendingMessage) Meteor._debug('For: ', msg.offendingMessage);
|
||||
}
|
||||
|
||||
_callOnReconnectAndSendAppropriateOutstandingMethods() {
|
||||
async _callOnReconnectAndSendAppropriateOutstandingMethods() {
|
||||
const self = this;
|
||||
const oldOutstandingMethodBlocks = self._outstandingMethodBlocks;
|
||||
self._outstandingMethodBlocks = [];
|
||||
|
||||
self.onReconnect && self.onReconnect();
|
||||
DDP._reconnectHook.each(callback => {
|
||||
callback(self);
|
||||
return true;
|
||||
await DDP._reconnectHook.forEachAsync(async callback => {
|
||||
await callback(self);
|
||||
});
|
||||
|
||||
if (isEmpty(oldOutstandingMethodBlocks)) return;
|
||||
@@ -1904,7 +1903,7 @@ export class Connection {
|
||||
}
|
||||
}
|
||||
|
||||
onReset() {
|
||||
async onReset() {
|
||||
// Send a connect message at the beginning of the stream.
|
||||
// NOTE: reset is called even on the first connection, so this is
|
||||
// the only place we send this message.
|
||||
@@ -1977,7 +1976,7 @@ export class Connection {
|
||||
// `onReconnect` get executed _before_ ones that were originally
|
||||
// outstanding (since `onReconnect` is used to re-establish auth
|
||||
// certificates)
|
||||
this._callOnReconnectAndSendAppropriateOutstandingMethods();
|
||||
await this._callOnReconnectAndSendAppropriateOutstandingMethods();
|
||||
|
||||
// add new subscriptions at the end. this way they take effect after
|
||||
// the handlers and we don't see flicker.
|
||||
|
||||
Reference in New Issue
Block a user