Bugfix: fix some issues with kobo sync #3352
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Kobo sync's logic is incorrect, and looks like it pretty much always has been. This is seen on initial sync of a freshly reset device against c-w configured to sync all shelves. I have 1500+ books to sync, but c-w syncs only about 250 or so before saying it's done. That's two full batches of 100, followed by a partial batch.
The problem is in the way the query performs paging. On the first pass it discovers all the books that need to be synced. On the second pass it does pretty well. Third pass, it does badly. All this is because of the way it currently detects which books have been modified since last sync. As it goes through the sync, this query result set gets progressively smaller, incorrectly.
I've tried to repair the logic, and what I get now works perfectly for my case. I'm not 100% sure it's exactly right but it's doing a lot better now for both initial sync and maintenance sync.
I had trouble understanding what was going on in kobo.py initially, so I also updated some of the logging to help out. This should be seen as a net improvement, though not strictly necessary.