1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-28 05:03:59 +03:00

Interrupt /sync backoff when keep-alive succeeds in order to immediately retry if we were waiting

This commit is contained in:
Kegan Dougal
2016-01-21 18:02:26 +00:00
parent c5e7df8975
commit f8ec35691f
2 changed files with 5 additions and 1 deletions

View File

@@ -279,7 +279,7 @@ MatrixClient.prototype.retryImmediately = function() {
// stop waiting
clearTimeout(this._syncingRetry.timeoutId);
// invoke immediately
this._syncingRetry.fn();
this._syncingRetry.fn(2); // FIXME: It shouldn't need to know about attempts :/
this._syncingRetry = null;
return true;
};

View File

@@ -545,6 +545,10 @@ SyncApi.prototype._sync = function(syncOptions, attempt) {
debuglog("Aborting current /sync.");
self._currentSyncRequest.abort();
}
// immediately retry if we were waiting
debuglog(
"Interrupted /sync backoff: %s", self.client.retryImmediately()
);
});
}
console.error("/sync error (%s attempts): %s", attempt, err);