I have this following scenario:
- A user makes a GET request to
/projects/1
and receives an ETag. - The user makes a PUT request to
/projects/1
with the ETag from step #1. - The user makes another PUT request to
/projects/1
with the ETag from step #1.
Normally, the second PUT request would receive a 412 response, since the ETag is now stale - the first PUT request modified the resource, so the ETag doesn't match anymore.
But what if the two PUT requests are sent at the same time (or exactly one after the other)? The first PUT request does not have time to process and update the resource before PUT #2 arrives, which causes PUT #2 to overwrite PUT #1. The whole point of optimistic locking is for that not to happen...