On 3/26/21 4:33 PM, Emiliano Heyns wrote:
> A fair bit of that code is creating specialized views that Richard
> needed for his analysis. The actual sync isn't too hard now that I
> look at it again, but the note from earlier stands -- you can be told
> mid-sync you have to abort and retry, so transactions are going to be
> required.
Not really transactions. For a one-way pull, if the remote version
changes in the middle of a multi-request process, you'd just want to
restart the sync, probably after a brief pause to allow a remote process
to finish. There's no inherent problem if you don't, as long as you're
only storing the earliest library version you received and passing that
for your 'since' value (so that you don't miss updates), but you might
end up with an inconsistent view of the library that wouldn't be
resolved until the next sync. It could also result in a save failure if,
say, an item references a collection that was added after you started
the sync.
You don't need actual transactions in terms of your database store. A
sync process can involve dozens or hundreds of requests, and there's no
reason to roll everything back if there's a later problem.