From c51290641da90ea44cedc188ce8ac12af44fd985 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 28 Mar 2011 00:05:29 +0000 Subject: [PATCH] Prevent auto-sync attempt when switching pane/tab mode shortly after pane/tab open if a sync is already running --- chrome/content/zotero/zoteroPane.js | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) 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;