Suppose there is a server with a database system with clients connecting directly to it (so there is no server "program").
Imagine a call center software (it could be anything). So the database contains a table with people to call. The column "due_on" is of special interest. It is set to date when a person is due to be called.
The algorithm works like this: of all the people that have due_on set to a date equal or earlier than today, choose the nearest one and return it.
So client A says to the server: "gimme a person to call" and the server returns a person's id based on the algorithm.
The problem is here:
If client B want to get a person to call as well, there is a chance that it will get the same person (because the request came in a moment after the client A got this person and before this person was taken out / marked as already being called).
What is the simplest solution to prevent duplication here?
Maybe it's something obvious, maybe not... I really cannot see the simple solution.. if the server was running a process which was connecting to the DB, this would be a different story.
Thank you for tips!
david
Start Free Trial