mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-28 17:01:14 +00:00
d41b0f1feb
Adjustments:Load() runs from the esx:playerLoaded handler, so it runs again on every character switch. AmmoAndVehicleRewards, Multipliers and DiscordPresence each start a `while true` thread that never exits, and SeatShuffle and DisableRadio register another esx:enteredVehicle handler. Nothing tears any of it down, so a player who switches characters a few times ends up with several per-frame threads all writing the same values, and client performance degrades until they reconnect. The loops now run `while ESX.PlayerLoaded`, the same way StartServerSyncLoops and Actions:SlowLoop already do, so they end on logout and a fresh one starts on the next load. The two event handlers are registered once. Actions:Init already documents this exact concern in a comment; Adjustments never got the same treatment. Measured in game on artifact 25770 by counting thread ticks per frame: before: 2.01 -> 3.01 -> 4.02 across two relogs after: 1.00 -> 1.00 -> 1.00