diff --git a/chrome/content/zotero/xpcom/sync/syncRunner.js b/chrome/content/zotero/xpcom/sync/syncRunner.js index 912a3fdc4..da99dd45a 100644 --- a/chrome/content/zotero/xpcom/sync/syncRunner.js +++ b/chrome/content/zotero/xpcom/sync/syncRunner.js @@ -139,6 +139,19 @@ Zotero.Sync.Runner_Module = function (options = {}) { this.updateIcons('animate'); + // purgeDataObjects() starts a transaction, so if there's an active one then show a + // nice message and wait until there's not. Another transaction could still start + // before purgeDataObjects() and result in a wait timeout, but this should reduce the + // frequency of that. + while (Zotero.DB.inTransaction()) { + this.setSyncStatus(Zotero.getString('sync.status.waiting')); + Zotero.debug("Transaction in progress -- waiting to sync"); + yield Zotero.DB.waitForTransaction('sync'); + _stopCheck(); + } + + this.setSyncStatus(Zotero.getString('sync.status.preparing')); + // Purge deleted objects so they don't cause sync errors (e.g., long tags) yield Zotero.purgeDataObjects(true); diff --git a/chrome/locale/en-US/zotero/zotero.properties b/chrome/locale/en-US/zotero/zotero.properties index 209e43926..4ec928bba 100644 --- a/chrome/locale/en-US/zotero/zotero.properties +++ b/chrome/locale/en-US/zotero/zotero.properties @@ -952,6 +952,8 @@ sync.conflict.chooseThisVersion = Choose this version sync.status.notYetSynced = Not yet synced sync.status.lastSync = Last sync: +sync.status.waiting = Waiting for other operations to finish +sync.status.preparing = Preparing sync sync.status.loggingIn = Logging in to sync server sync.status.gettingUpdatedData = Getting updated data from sync server sync.status.processingUpdatedData = Processing updated data from sync server