mirror of
https://github.com/qbcore-fivem/qb-core.git
synced 2026-08-28 22:01:33 +00:00
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:
+1
-1
@@ -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')
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user