mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-18 15:36:02 +01:00
refactor(server/cron): run jobs in a new thread
Better for error handling.
This commit is contained in:
@@ -238,12 +238,14 @@ function OxTask:scheduleTask()
|
|||||||
end
|
end
|
||||||
|
|
||||||
if self.isActive then
|
if self.isActive then
|
||||||
self:job(currentDate)
|
|
||||||
|
|
||||||
if self.debug then
|
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
|
end
|
||||||
|
|
||||||
|
Citizen.CreateThreadNow(function()
|
||||||
|
self:job(currentDate)
|
||||||
|
end)
|
||||||
|
|
||||||
Wait(30000)
|
Wait(30000)
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
|||||||
Reference in New Issue
Block a user