I have developed an web ticketing system at my work place and have gone into a strange trouble.
All the tickets raised are stored into a mysql table. The open tickets are identified by a column 'assigned' wherein 'false' is the default value of the tickets not assigned. Then an engineer clicks a button, 'Get Ticket' on the web page and based on priority a ticket is assigned to the engineer.
The tool worked perfect, however, since the past 2-3 days, when the ticket flow increased, there are occurrences that 2 or 3 engineers press the 'Get Ticket' button together and all of them are assigned the same ticket.
Can anyone help me what is the best possible way to avoid such bug.
I have even tried to lock the database, but didn't work. I am looking towards MySQL transactions, but i think that might slow down the application.
Please help with any suggestions!