0

for an endpoint that assigns jobs to employees, I would like the requests to the endpoint to be processed sequentially so that it is not possible for multiple employees to sign up for a job. Is there a way to do this ? Or maybe even something better ? How does this work on shopping sites with carts ? These often also need to check first if the product is available and prevent two users from buying the last product.

Thanks a lot!

Jocasso
  • 465
  • 1
  • 7
  • 20
  • You could google for pessimistic locking and why this is sometimes a bad idea especially on large online web-shops (https://en.wikipedia.org/wiki/Concurrency_control). For your use case ptimistic_concurrency_control -> https://en.wikipedia.org/wiki/Optimistic_concurrency_control seams sufficient. https://stackoverflow.com/questions/17431338/optimistic-locking-in-mysql – Andreas Sep 20 '22 at 10:14

0 Answers0