abort the realtime session if it does not synchronize for 30 seconds
parent
29c6ed6e9b
commit
4a37bc4a1c
|
@ -36,6 +36,8 @@ define(function () {
|
|||
out.synced = "Everything is saved";
|
||||
out.deleted = "Pad deleted from your CryptDrive";
|
||||
|
||||
out.realtime_unrecoverableError = "The realtime engine has encountered an unrecoverable error. Click OK to reload.";
|
||||
|
||||
out.disconnected = 'Disconnected';
|
||||
out.synchronizing = 'Synchronizing';
|
||||
out.reconnecting = 'Reconnecting...';
|
||||
|
|
|
@ -202,13 +202,29 @@ define([
|
|||
return;
|
||||
};
|
||||
|
||||
common.infiniteSpinnerDetected = false;
|
||||
var whenRealtimeSyncs = common.whenRealtimeSyncs = function (realtime, cb) {
|
||||
realtime.sync();
|
||||
|
||||
window.setTimeout(function () {
|
||||
if (realtime.getAuthDoc() === realtime.getUserDoc()) {
|
||||
return void cb();
|
||||
}
|
||||
|
||||
var to = setTimeout(function () {
|
||||
realtime.abort();
|
||||
// don't launch more than one popup
|
||||
if (common.infiniteSpinnerDetected) { return; }
|
||||
|
||||
// inform the user their session is in a bad state
|
||||
common.confirm(Messages.realtime_unrecoverableError, function (yes) {
|
||||
if (!yes) { return; }
|
||||
window.location.reload();
|
||||
});
|
||||
common.infiniteSpinnerDetected = true;
|
||||
}, 30000);
|
||||
realtime.onSettle(function () {
|
||||
clearTimeout(to);
|
||||
cb();
|
||||
});
|
||||
}, 0);
|
||||
|
|
Loading…
Reference in New Issue