-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conflict over saving after real time #1412
Comments
Probably on the long term |
The document sent by cozy-stack in real time is the CouchDB document. Unlike a call to the JSON Api, the document does not contain the attribute field. When a change was made, it generated a conflict error. I modified the RealTimeQueries so that I could modify the real-time object before integrating it into the cozy-client. This makes it possible to have the same version everywhere and avoid conflicts. See also: cozy/cozy-client#1412
The document sent by cozy-stack in real time is the CouchDB document. Unlike a call to the JSON Api, the document does not contain the attribute field. When a change was made, it generated a conflict error. I modified the RealTimeQueries so that I could modify the real-time object before integrating it into the cozy-client. This makes it possible to have the same version everywhere and avoid conflicts. See also: cozy/cozy-client#1412
The document sent by cozy-stack in real time is the CouchDB document. Unlike a call to the JSON Api, the document does not contain the attribute field. When a change was made, it generated a conflict error. I modified the RealTimeQueries so that I could modify the real-time object before integrating it into the cozy-client. This makes it possible to have the same version everywhere and avoid conflicts. See also: cozy/cozy-client#1412
Let me reopen the debate. Once again, we have the problem of syncing data between the @bruno do you think you could investigate to give at least some leads to explore please? |
I encountered a problem when working on cozy-settings between real time and saving a document. The document in question is
io.cozy.settings.instance
but I think that the case can be found in other places.The document sent by cozy-stack in real time is the CouchDB document. Unlike a call to the JSON Api, the document does not contain the
attribute
field. The stack also adds calculation fields to the call.This difference in behaviour means that when a modification is made with a
client.save
, a 409 error of the conflict type is generated. The document stored in cozy-client does not correspond to the one used by the stack.Solution 1:
One solution used was to call the JSON Api to retrieve the last object before updating systematically. This is not optimal in terms of performance and network consumption.
Solution 2:
Modify RealTimeQueries to be able to modify the object according to business rules before integrating it into the cozy-client store. I've done an initial PR on cozy-client for this solution, but I've still got to formalise an API that suits everyone.
Solution 3:
The solution would be to unify the document returned by the JSON Api and the real-time feedback so as to have a single source of truth. This is undoubtedly a long-term solution, but @nono, would it be viable for the stack?
If you see any other way of solving the problem, I'd be glad to discuss it.
The text was updated successfully, but these errors were encountered: