learningequality/morango

DatabaseMaxCounters are not updated after dequeuing, but after deserialization

Closed this issue · 0 comments

Background

Prior to the new sync operations architecture, deserialization occurred within the same database transaction in which dequeuing also occurred. So if there was a failure during deserialization, any changes to the Store should have been rolled back and thus database counters would continue to match the current state of the Store.

With the new architecture, updating the counters was placed after deserialization, because that kept it consistent in where it occurred previously with regards to sync timeline. Although, since the new operations architecture separated dequeuing and deserialization, if deserialization failed, the database counters would not reflect the changes to the Store made during dequeuing.

Observed behavior

Deserialization conflicts have arisen in the data handling on KDP due to this issue.

Expected behavior

The database counters are updated whenever the Store is updated. This also has the benefit that should the sync be interrupted during the dequeuing stage, a retry of the sync should determine that it doesn't need to resync the same data, even though deserialization wasn't completed.