API Design · Senior · Question 11 of 75
How should idempotency keys behave when the first request is still in progress and a retry arrives?
- ✓Correct answer: The retry should wait or get a
409/'in progress' response, not start the work a second time; a lock on the key prevents concurrent execution - 2The second request should cancel the first
- 3Both requests should run
Explanation
Store the key before doing work, with a status. Release or expire locks if the worker crashes.