abort the realtime session if it does not synchronize for 30 seconds
This commit is contained in:
parent
29c6ed6e9b
commit
4a37bc4a1c
@ -36,6 +36,8 @@ define(function () {
|
|||||||
out.synced = "Everything is saved";
|
out.synced = "Everything is saved";
|
||||||
out.deleted = "Pad deleted from your CryptDrive";
|
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.disconnected = 'Disconnected';
|
||||||
out.synchronizing = 'Synchronizing';
|
out.synchronizing = 'Synchronizing';
|
||||||
out.reconnecting = 'Reconnecting...';
|
out.reconnecting = 'Reconnecting...';
|
||||||
|
|||||||
@ -202,13 +202,29 @@ define([
|
|||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
common.infiniteSpinnerDetected = false;
|
||||||
var whenRealtimeSyncs = common.whenRealtimeSyncs = function (realtime, cb) {
|
var whenRealtimeSyncs = common.whenRealtimeSyncs = function (realtime, cb) {
|
||||||
realtime.sync();
|
realtime.sync();
|
||||||
|
|
||||||
window.setTimeout(function () {
|
window.setTimeout(function () {
|
||||||
if (realtime.getAuthDoc() === realtime.getUserDoc()) {
|
if (realtime.getAuthDoc() === realtime.getUserDoc()) {
|
||||||
return void cb();
|
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 () {
|
realtime.onSettle(function () {
|
||||||
|
clearTimeout(to);
|
||||||
cb();
|
cb();
|
||||||
});
|
});
|
||||||
}, 0);
|
}, 0);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user