Hopefully fix "Too many sync requests" after file upload 412

Addresses #1788
This commit is contained in:
Dan Stillman 2020-02-16 13:06:15 -05:00
parent 5c95d4e0ba
commit 804a898c98
2 changed files with 13 additions and 0 deletions

View file

@ -533,6 +533,11 @@ Zotero.Sync.Storage.Mode.ZFS.prototype = {
return "ERROR_412_WITHOUT_VERSION";
}
if (version > item.version) {
// Mark object for redownloading, in case the library version is up to date and
// it's just the attachment item that somehow didn't get updated
yield Zotero.Sync.Data.Local.addObjectsToSyncQueue(
'item', item.libraryID, [item.key]
);
return new Zotero.Sync.Storage.Result({
syncRequired: true
});
@ -558,6 +563,11 @@ Zotero.Sync.Storage.Mode.ZFS.prototype = {
json = json[0];
if (json.data.version > item.version) {
// Mark object for redownloading, in case the library version is up to date and
// it's just the attachment item that somehow didn't get updated
yield Zotero.Sync.Data.Local.addObjectsToSyncQueue(
'item', item.libraryID, [item.key]
);
return new Zotero.Sync.Storage.Result({
syncRequired: true
});

View file

@ -985,6 +985,9 @@ describe("Zotero.Sync.Storage.Mode.ZFS", function () {
assert.isFalse(result.localChanges);
assert.isFalse(result.remoteChanges);
assert.isTrue(result.syncRequired);
// Item should be marked for redownloading
var versions = yield Zotero.Sync.Data.Local.getObjectsFromSyncQueue('item', item.libraryID);
assert.include(versions, item.key);
});