www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 8853f8ca47802dfed6d7fff24965e447b988bbf8
parent 794d3880e7f05c7155b39a6970f3b21f96e88d27
Author: Dan Stillman <dstillman@zotero.org>
Date:   Sat, 14 Apr 2018 16:40:36 -0400

Allow higher local object version during full sync

Local object versions can be higher than remote versions, because we
upload in batches and only record the version from the last batch.

This could cause trouble if an object failed to upload during a Restore
to Online Library, causing it to be retried later with version 0 (unlike
during a restore when the version is omitted), causing the library to be
reset, causing any local objects with higher local versions to be
redownloaded.

Diffstat:
Mchrome/content/zotero/xpcom/sync/syncEngine.js | 16++++------------
1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/chrome/content/zotero/xpcom/sync/syncEngine.js b/chrome/content/zotero/xpcom/sync/syncEngine.js @@ -1691,22 +1691,14 @@ Zotero.Sync.Data.Engine.prototype._fullSync = Zotero.Promise.coroutine(function* for (let key in results.versions) { let version = results.versions[key]; let obj = objectsClass.getByLibraryAndKey(this.libraryID, key); - // If object already at latest version, skip + // If object is already at or above latest version, skip. Local version can be + // higher because, as explained in _uploadObjects(), we upload items in batches + // and only get the last version to record in the database. let localVersion = localVersions[key]; - if (localVersion && localVersion === version) { + if (localVersion && localVersion >= version) { continue; } - // This should never happen - if (localVersion > version) { - Zotero.logError(`Local version of ${objectType} ${this.libraryID}/${key} ` - + `is later than remote! (${localVersion} > ${version})`); - // Delete cache version if it's there - yield Zotero.Sync.Data.Local.deleteCacheObjectVersions( - objectType, this.libraryID, key, localVersion, localVersion - ); - } - if (obj) { Zotero.debug(`${ObjectType} ${obj.libraryKey} is older than remote version`); }