You've already forked matrix-js-sdk
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:
@@ -279,7 +279,7 @@ MatrixClient.prototype.retryImmediately = function() {
|
|||||||
// stop waiting
|
// stop waiting
|
||||||
clearTimeout(this._syncingRetry.timeoutId);
|
clearTimeout(this._syncingRetry.timeoutId);
|
||||||
// invoke immediately
|
// invoke immediately
|
||||||
this._syncingRetry.fn();
|
this._syncingRetry.fn(2); // FIXME: It shouldn't need to know about attempts :/
|
||||||
this._syncingRetry = null;
|
this._syncingRetry = null;
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -545,6 +545,10 @@ SyncApi.prototype._sync = function(syncOptions, attempt) {
|
|||||||
debuglog("Aborting current /sync.");
|
debuglog("Aborting current /sync.");
|
||||||
self._currentSyncRequest.abort();
|
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);
|
console.error("/sync error (%s attempts): %s", attempt, err);
|
||||||
|
|||||||
Reference in New Issue
Block a user