SpinTheMic
Pro

Interview practice question

Same request processed twice concurrently

Backend Engineering · Concurrency · Intermediate

A user double-clicks "Submit", sending two identical requests that are processed at the same time and create two records. How do you prevent this?

What a strong answer covers

Your AI report card counts how many of these ideas you cover.

  • Idempotency key from client.
  • Unique constraint in DB.
  • Disable button on client (UX only).
  • Lock per user action if needed.
  • Return same result to both.
Practise this topic

Start without signing up. Sign in free to get an AI report card on your answer.

See all topics