Prevent infinite loop in client when first changed usn != lastUsn

Anki expects the last change in the list to have the server's lastUsn.

Reference: cca3fcb241/anki/sync.py (L720)
This commit is contained in:
flan
2020-01-26 10:44:06 +01:00
parent 2bfccf7fa4
commit 3c440621d2
2 changed files with 19 additions and 0 deletions

View File

@@ -327,6 +327,10 @@ class SyncMediaHandler:
for fname,usn,csum, in self.col.media.db.execute("select fname,usn,csum from media order by usn desc limit ?", server_lastUsn - lastUsn):
result.append([fname, usn, csum])
# anki assumes server_lastUsn == result[-1][1]
# ref: anki/sync.py:720 (commit cca3fcb2418880d0430a5c5c2e6b81ba260065b7)
result.reverse()
return {'data': result, 'err': ''}
def mediaSanity(self, local=None):