06.08.2019, 08:04
I will quote maddinat0r:
Almost none of the released gamemodes check against it but it is quite important.
You forgot to add the index. Without an index, it does full table scan but with it it scans only 1 row. Thanks.
pawn Code:
/* race condition check:
player A connects -> SELECT query is fired -> this query takes very long
while the query is still processing, player A with playerid 2 disconnects
player B joins now with playerid 2 -> our laggy SELECT query is finally finished, but for the wrong player
what do we do against it?
we create a connection count for each playerid and increase it everytime the playerid connects or disconnects
we also pass the current value of the connection count to our OnPlayerDataLoaded callback
then we check if current connection count is the same as connection count we passed to the callback
if yes, everything is okay, if not, we just kick the player
*/
You forgot to add the index. Without an index, it does full table scan but with it it scans only 1 row. Thanks.