1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-29 16:43:09 +03:00

Revert "Handle the first /sync failure differently."

This commit is contained in:
David Baker
2016-10-06 16:27:38 +01:00
committed by GitHub
parent 02f8e7da3d
commit 86ea00cfee
2 changed files with 6 additions and 33 deletions

View File

@@ -545,28 +545,13 @@ SyncApi.prototype._sync = function(syncOptions) {
console.error("/sync error %s", err);
console.error(err);
if (!self._syncConnectionLost) {
// This is the first failure, which may be spurious. To avoid unnecessary
// connection error warnings we simply retry the /sync immediately. Only
// if *that* one fails too do we say the connection has been lost.
// Examples of when this may happen are:
// - Restarting backend servers. (In an HA world backends may be
// restarted all the time, and its easiest just to make the
// client retry).
// - Intermediate proxies restarting.
// - Device network changes.
// Should we emit a state like "MAYBE_CONNETION_LOST"?
self._syncConnectionLost = true;
debuglog("Starting keep-alive");
self._syncConnectionLost = true;
self._startKeepAlives().done(function() {
self._sync(syncOptions);
} else {
debuglog("Starting keep-alive");
self._syncConnectionLost = true;
self._startKeepAlives().done(function() {
self._sync(syncOptions);
});
self._currentSyncRequest = null;
self._updateSyncState("ERROR", { error: err });
}
});
self._currentSyncRequest = null;
self._updateSyncState("ERROR", { error: err });
});
};