Fix: server side graves's usn need not set as -1
once client items in graves have been remove in the server,need update graves usn as maxusn avoid sync serve log: sanity check failed with server: graves had usn = -1 such as issue #28 second comment
This commit is contained in:
parent
f5dca1f1e2
commit
3d5d27bf6f
@ -64,7 +64,7 @@ class CollectionWrapper:
|
|||||||
return col
|
return col
|
||||||
|
|
||||||
def _get_collection(self):
|
def _get_collection(self):
|
||||||
col = anki.storage.Collection(self.path)
|
col = anki.storage.Collection(self.path, server=True)
|
||||||
|
|
||||||
# Ugly hack, replace default media manager with our custom one
|
# Ugly hack, replace default media manager with our custom one
|
||||||
col.media.close()
|
col.media.close()
|
||||||
|
|||||||
@ -185,8 +185,6 @@ from notes where %s""" % lim, self.maxUsn)
|
|||||||
return dict(cards=cards, notes=notes, decks=decks)
|
return dict(cards=cards, notes=notes, decks=decks)
|
||||||
|
|
||||||
def remove(self, graves):
|
def remove(self, graves):
|
||||||
# pretend to be the server so we don't set usn = -1
|
|
||||||
self.col.server = True
|
|
||||||
|
|
||||||
# notes first, so we don't end up with duplicate graves
|
# notes first, so we don't end up with duplicate graves
|
||||||
self.col._remNotes(graves['notes'])
|
self.col._remNotes(graves['notes'])
|
||||||
@ -196,7 +194,6 @@ from notes where %s""" % lim, self.maxUsn)
|
|||||||
for oid in graves['decks']:
|
for oid in graves['decks']:
|
||||||
self.col.decks.rem(oid, childrenToo=False)
|
self.col.decks.rem(oid, childrenToo=False)
|
||||||
|
|
||||||
self.col.server = False
|
|
||||||
|
|
||||||
# Models
|
# Models
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user