mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-17 06:56:03 +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
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user