So we have a slight issue with our ULX sync system.
When a new player joins, or a player that is in the user group joins once more, they are writting to a users.txt file as per the below.
local function LoadRank(player) local load = false local queryQ = ULXDB:query("SELECT * FROM `"..ULX_TABLE.."` WHERE `steam`='"..player:SteamID().."';") queryQ.onData = function(Q,D) queryQ.onSuccess = function(q) Msg("Found "..player:GetName().." in database! ") ulx.addusermysql(nil,player:SteamID(),D.group) load = true end end queryQ.onerror = function(Q,E) print("LoadRank threw an error:") print(E) end queryQ:start() if (load == false) then ulx.addusermysql(nil,player:SteamID(),"user") end end
Take note of the “if (load == false) then
this causes a file write to users.txt for ULIB.
Which causes lag whenever a player joins (as the users.txt file get’s huge (500KB in a couple days) and lags when is read/written.
The purpose of this is to ensure ranks are synced, so if a player is not found in the database they are written to user, like if an admin was demoted for example.
Thoughts on ways to instead write to a database or a different fix to stop the lag?