Closed benpoulson closed 7 years ago
The way the database entry works should prevent a race condition. The script performs an insert against a table with a unique column for the mutex, if it succeeds then it continues, if it fails it does not. The database will prevent two processes from successfully completing the insert at the same time.
Without row-level locking, or synchronous processing you can't guarantee that two processes won't lock at the same split second.
I would consider ditching the database, and moving over to Redis/Memcached. Or at least looking into Laravel's Pessimistic Locking.