You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe this code doesn't conform to one of the requirements for implementing the push endpoint. In the spec, it says:
If the changes object contains a record that has been modified on the server after lastPulledAt, you MUST abort push and return an error code
This scenario means that there's a conflict, and record was updated remotely between user's pull and push calls. Returning an error forces frontend to call pull endpoint again to resolve the conflict
I believe that the proper way to handle this would be to use Firestore transactions that check that updatedAt and deletedAt (and createdAt?) are less than lastPulledAt. Could either be one transaction per operation, or one big transaction, keeping in mind that it would be possible in theory to hit the 500 write limit for transactions. One advantage of using a single transaction, though, is that it would mean the code would also satisfy rule 7:
The push endpoint MUST be fully transactional. If there is an error, all local changes MUST be reverted, and en error code MUST be returned.
But cool library; thanks for making it!
The text was updated successfully, but these errors were encountered:
I believe this code doesn't conform to one of the requirements for implementing the push endpoint. In the spec, it says:
I believe that the proper way to handle this would be to use Firestore transactions that check that
updatedAt
anddeletedAt
(andcreatedAt
?) are less thanlastPulledAt
. Could either be one transaction per operation, or one big transaction, keeping in mind that it would be possible in theory to hit the 500 write limit for transactions. One advantage of using a single transaction, though, is that it would mean the code would also satisfy rule 7:But cool library; thanks for making it!
The text was updated successfully, but these errors were encountered: