What is a good way to set up a queue for users to share so that two users don’t get the same item from the queue?
I have a shared queue for multiple users. Each worker clicks the link to start working which brings up the next available item to be worked. They either mark it complete, in which case it is flagged as such and not included in the scope that is still workable.
If the task is flagged as incomplete it’s last worked date is set as the current time. The workable scope is sorted by last worked date so this effectively sends it to the back of the list.
I’m trying to figure out the best way to guarantee that no two users get the same task. In other words, when someone takes a task from the queue it is no longer available to the others.
The obvious thought is to update their last worked date immedialtely when someone takes one, but what if two people simultaneously take the same one?
I’m sure this problem has been solved before. Any ideas?