diff --git a/lib/client.js b/lib/client.js index 3a45b695f..f5d6a74a0 100644 --- a/lib/client.js +++ b/lib/client.js @@ -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; }; diff --git a/lib/sync.js b/lib/sync.js index e670e3702..75c9edebc 100644 --- a/lib/sync.js +++ b/lib/sync.js @@ -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);