Prevent MySQL row being updated twice at once? (nodejs mysql)
I have this code in my server node__s file to update a row in mysql db using a mysql module using socket.io that is updated every second:
var query_update = mysql.query('UPDATE `auctions` \
SET `random` = ?,`price`= ?,`datetime` = ? WHERE `id` = ?', \
[rand, price, t, auction.id]);
console.log('\n'+time()+query_update.sql+'\n');
I don't know why, but some specific line entries will update twice at a time. Is there a way to prevent this? Maybe even mysql-wise that a row can be updated every x seconds once?
I also used milliseconds as the output of console.log (during the () function) to figure out if this happens a few milliseconds after the first update, but it happens at the same moment:
Other auctions just update once and I can't figure out why.
+3
user3973556
source
to share