don't complain about bad realtime state just because you disconnected

pull/1/head
ansuz 7 years ago
parent 3b20dcd435
commit 290763d6c5

@ -8,6 +8,8 @@ define([
var BAD_STATE_TIMEOUT = typeof(AppConfig.badStateTimeout) === 'number'? var BAD_STATE_TIMEOUT = typeof(AppConfig.badStateTimeout) === 'number'?
AppConfig.badStateTimeout: 30000; AppConfig.badStateTimeout: 30000;
var connected = false;
/* /*
TODO make this not blow up when disconnected or lagging... TODO make this not blow up when disconnected or lagging...
*/ */
@ -20,6 +22,7 @@ define([
} }
var to = setTimeout(function () { var to = setTimeout(function () {
if (!connected) { return; }
realtime.abort(); realtime.abort();
// don't launch more than one popup // don't launch more than one popup
if (common.infiniteSpinnerDetected) { return; } if (common.infiniteSpinnerDetected) { return; }
@ -38,5 +41,10 @@ define([
}, 0); }, 0);
}; };
common.setConnectionState = function (bool) {
if (typeof(bool) !== 'boolean') { return; }
connected = bool;
};
return common; return common;
}); });

@ -1849,12 +1849,18 @@ define([
Store.ready(function (err, storeObj) { Store.ready(function (err, storeObj) {
store = common.store = env.store = storeObj; store = common.store = env.store = storeObj;
common.addDirectMessageHandler(common); common.addDirectMessageHandler(common);
var proxy = getProxy(); var proxy = getProxy();
var network = getNetwork(); var network = getNetwork();
network.on('disconnect', function () {
Realtime.setConnectionState(false);
});
network.on('reconnect', function () {
Realtime.setConnectionState(true);
});
if (Object.keys(proxy).length === 1) { if (Object.keys(proxy).length === 1) {
feedback("FIRST_APP_USE", true); feedback("FIRST_APP_USE", true);
} }

Loading…
Cancel
Save