h4. Definition
When more than one operation is done on the same object (type and id is the same) and we have squasing functionality disabled, second request will always end up with conflict.
1. Application is offline 2. Edit is made on object A1 3. Second edit is made on object A1 4. Application becomes online 5. First edit is send to server 6. Second edit is send to server but it causes conflict. Depending on strategy data could be lost.
h4. Solutions to resolve this issue
h5. Hook version updates into queue
Before step 6 we will need to record version sent from the server and try to apply it to the elements in the queue. We do that already with the id's of the optimistic responses.
Pros: - Simplicity
Cons: - Queue need to know about the conflicts mechanism - Hard to abstract (it will make strong dependency between conflict and offline link)
h5. Batching offline requests
When sending offline requests we should batch them into single request. Batching will allow us to avoid squashing option and be more network efficient. Server side that will process the batched request will need to adjust to the versions properly.
Batched data could cause multiple conflicts so we will need to rewrite also client to handle that case. |
|