let's suppose that I have an endpoint /seen/{bigint_number}
,
which is about 10K concurrently visits that with a random bigint number.
the logic is simple. if the number is already stored in the database, it returns true, if the number has not been stored yet, it got stored and returns false.
the logic is first "select * from myTable where number = bigint_number
" if found return true, else
insert into the table.
the race condition is here when the same concurrent user has the same number.
how we can avoid this?