Wait for any DB transactions to finish before starting sync
purgeDataObjects(), which runs at the beginning of the sync process, uses transactions, and those can fail after the default wait timeout if there's another active transaction. Instead, check explicitly for another transaction and, if there is one, display a nice message and wait for it to finish. This isn't foolproof, but it should reduce the frequency of "operation timed out" sync errors. (Avoiding all long transactions would be a better solution.)
This commit is contained in:
parent
3f6ecc0021
commit
bd7e1b222d
2 changed files with 15 additions and 0 deletions
|
@ -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);
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue