refactor(server/cron): run jobs in a new thread

Better for error handling.
This commit is contained in:
Linden
2023-10-23 15:47:27 +11:00
parent 0b5ad76721
commit 2a1d6aa2ae

View File

@@ -238,12 +238,14 @@ function OxTask:scheduleTask()
end
if self.isActive then
self:job(currentDate)
if self.debug then
print(('(%s/%s/%s %s:%s) ran task %s'):format(currentDate.year, currentDate.month, currentDate.day, currentDate.hour, currentDate.min, self.id))
print(('(%s/%s/%s %s:%s) running task %s'):format(currentDate.year, currentDate.month, currentDate.day, currentDate.hour, currentDate.min, self.id))
end
Citizen.CreateThreadNow(function()
self:job(currentDate)
end)
Wait(30000)
return true