diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js index 5bdd8f36ac..99e1deacad 100644 --- a/chrome/content/zotero/zoteroPane.js +++ b/chrome/content/zotero/zoteroPane.js @@ -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;