Reduce client loop CPU usage; tweak Kick timing

Increase client loop default sleep from 0 to 1000 to avoid a tight busy-wait when the player is not logged in, reducing CPU usage. In server/functions.lua move the Wait(100) out of the inner Kick loop so the DropPlayer thread is spawned immediately and the short delay happens after the loop, improving timing and avoiding blocking behavior.
This commit is contained in:
Kakarot
2026-04-20 18:51:33 -05:00
parent 83152ac815
commit 6dbbfed6c7
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
CreateThread(function()
while true do
local sleep = 0
local sleep = 1000
if LocalPlayer.state.isLoggedIn then
sleep = (1000 * 60) * QBCore.Config.UpdateInterval
TriggerServerEvent('QBCore:UpdatePlayer')
+1 -1
View File
@@ -537,11 +537,11 @@ function QBCore.Functions.Kick(source, reason, setKickReason, deferrals)
if GetPlayerPing(source) >= 0 then
break
end
Wait(100)
CreateThread(function()
DropPlayer(source, reason)
end)
end
Wait(100)
end
Wait(5000)
end