fix: implementing optimistic concurrency control#2331
Conversation
7431c99 to
5b1c8b4
Compare
5b1c8b4 to
fc191d8
Compare
fc191d8 to
3df7b19
Compare
…ntService and small fix in origdatablock
04a01fb to
557f31c
Compare
bb58538 to
58266bb
Compare
nitrosx
left a comment
There was a problem hiding this comment.
Do we need a migration script for the db given that instruments are now inheriting from ownable?
Other than that, it is good to go for me.
|
@nitrosx Valid point. However, I am not entirely sure that a migration script is needed, because the two newly added required fields are createdBy and updatedBy. createdBy is already set for Instrument (at least in the test data of SciCatLive). Both fields are set automatically during creation/update in the service, and to my understanding, they are only validated during these operations. However, I can see how it could lead to problems or unexpected behavior when updatedBy is not set. I also found the migration script that sets updatedBy for other types (Attachment, Dataset, Proposal, etc.). So I added a migration script with the same logic for Instrument to be safe. |
## Description If the time send by the client is equal to the ressource on the server, the clients updated version is based on servers version with that time. or in other words: the client has taken into account the ressource on the server b/c the client should use the timestamp received with the ressource from the server. from the RFC: > The origin server MUST NOT perform the requested method > if the selected representation's last modification date is more > recent than the date provided in the field-value Client receives t0 Client sends update w/ t0 -> OK Server is on t1 Client received t0 (previously) Client sends update w/ t0 -> FAIL ## Motivation The current implementation does not accept timestamps equal to the server ressource as described above. ## Fixes * Fixup for helper function in "fix: implementing optimistic concurrency control (#2331)"
Description
This is a direct followup PR for #2138, addressing the change requests. Mainly introducing a helper function to reduce the code duplication in each controller function. The following Endpoints are modified:
The tests were left as they were in PR #2138, except for minor adjustments.
Changes compared to original PR: