Prevent auto-sync attempt when switching pane/tab mode shortly after pane/tab open if a sync is already running

This commit is contained in:
Dan Stillman 2011-03-28 00:05:29 +00:00
parent 86504b2424
commit c51290641d

View file

@ -387,16 +387,22 @@ var ZoteroPane = new function()
Zotero.debug("Purged data tables in " + (d2 - d) + " ms");
// Auto-sync on pane open
if (Zotero.Prefs.get('sync.autoSync') && Zotero.Sync.Server.enabled
&& !Zotero.Sync.Server.syncInProgress && !Zotero.Sync.Storage.syncInProgress) {
if (Zotero.Sync.Server.manualSyncRequired) {
Zotero.debug('Manual sync required -- skipping auto-sync', 4);
}
else {
setTimeout(function () {
Zotero.Sync.Runner.sync(true);
}, 1000);
}
if (Zotero.Prefs.get('sync.autoSync')) {
setTimeout(function () {
if (!Zotero.Sync.Server.enabled
|| Zotero.Sync.Server.syncInProgress
|| Zotero.Sync.Storage.syncInProgress) {
Zotero.debug('Sync already running -- skipping auto-sync', 4);
return;
}
if (Zotero.Sync.Server.manualSyncRequired) {
Zotero.debug('Manual sync required -- skipping auto-sync', 4);
return;
}
Zotero.Sync.Runner.sync(true);
}, 1000);
}
return true;