Closed NeilRashbrook closed 3 months ago
The other approach is to move listPersons
and listGroups
inside the loop, which should work, although it might mean more API calls.
I guess I don't understand why the old code is wrong. It saves the syncState, then saves the address book. If we didn't have an error until then, we saved all data from the server to the DB, and save the syncState as "checkpoint". If it fails in the next round, then - once the user clicks on "Get Mail" button, or changes folders, or restarts the app - we will make another attempt and pick up at the point before we failed. Right? Is there any problem with that?
The only problem that I see is when there's an item with an error, and we keep throwing, and all messages stop syncing at this point, forever. Thus, we should catch and report errors on a per-item level. This is fixed in #102
we saved all data from the server to the DB
No, because that's done by listPersons
and listGroups
.
So, you're no longer saving intermediate states? How about you save the then-current sync state after each round? Would that work?