2 ms·
As I understand it, it's not checking for the existence of the resource but for the existence of the request. Assuming the requests are unique to a user/client
by projektfu 3y ago
As I understand it, it's not checking for the existence of the resource but for the existence of the request. Assuming the requests are unique to a user/client and the user has a sequential conversation with the API server, the server would process the received requests in order and would reject the duplicate.
However, if the requests of the same key (duplicates) are sent to any of several API servers, you have a problem that must be resolved as you mentioned.
In the first case, if the API server dies, the client should establish a new connection and get new idempotency keys.
- xnorswap 3y agoEven on the same server there's still a race condition if checking the key has been used and marking the key as used aren't atomic if more than one request can be handled at once.