Issue resolved

esx_ambulancejob seems to cause strange server thread hitches which i can’t explain. Upon looking at the code I noticed that a Sync MySQL call happens. Would it be safe to make it async and why does this simple update mysql operation cause this lag in the first place?

RegisterNetEvent('esx_ambulancejob:setDeathStatus')
AddEventHandler('esx_ambulancejob:setDeathStatus', function(isDead)
	local xPlayer = ESX.GetPlayerFromId(source)

	if type(isDead) == 'boolean' then
		MySQL.Sync.execute('UPDATE users SET is_dead = @isDead WHERE identifier = @identifier', {
			['@identifier'] = xPlayer.identifier,
			['@isDead'] = isDead
		})
	end
end)

having some issues with server hitches myself but cant pinpoint the script, what do you use?

Regular FiveM Profiler. Just typed profiler record 1000 and profiler view in console.

1 Like

thanks brother ill have to try it out! just recently started happening and disabled past 30+ added scripts and still same errors, txadmin offered to give me a new server to switch to but wanna find issue first

1 Like

well you just helped me fix my login issue server threads <3 was playerhousing startup, now i need to fix these random small hiccups, not seeing anything really in the test besides my sql async at times