Skip to content

Commit

Permalink
fix:once client items in graves have been remove
Browse files Browse the repository at this point in the history
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 ankicommunity#28
second comment
  • Loading branch information
cecini committed Nov 3, 2020
1 parent f5dca1f commit 47f12cb
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
2 changes: 1 addition & 1 deletion src/ankisyncd/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def __create_collection(self):
return col

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
col.media.close()
Expand Down
3 changes: 0 additions & 3 deletions src/ankisyncd/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,6 @@ def removed(self):
return dict(cards=cards, notes=notes, decks=decks)

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
self.col._remNotes(graves['notes'])
Expand All @@ -196,7 +194,6 @@ def remove(self, graves):
for oid in graves['decks']:
self.col.decks.rem(oid, childrenToo=False)

self.col.server = False

# Models
##########################################################################
Expand Down

0 comments on commit 47f12cb

Please sign in to comment.