Reputation: 22306
I understand how I can use fetch the changes feed to list changes since the last fetch.
What I don't understand is how to incorporate this into a bi-directional sync algorithm. Specifically, how do I exclude my own changes from a subsequent fetch.
For example my sync does:- Phase 1. I fetch server changes. Let's say there are none Phase 2. I upload my local changes. Say a new file called NewFile
Some time later I sync again, and phase 1 includes NewFile as a change. Therefore NewFile gets round tripped.
I considered adding a phase 3 which repeats the fetch changes in order to advance the ChangeId and ignore those. The problem is that it is possible that another client was making updates during phase 2.
Upvotes: 2
Views: 212
Reputation: 41643
There is additional information you can use to test whether a file has changed, like the checksum, or etag for the entry, depending on whether you care about the file data, or the metadata too.
You should integrate this into your syncing algorithm so you don't get the race condition you talk about.
Upvotes: 2