mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-28 17:01:14 +00:00
Merge pull request #1839 from seltonmt012/fix/cron-callback-guard
fix(cron): keep the scheduler alive when a job errors
This commit is contained in:
@@ -46,7 +46,10 @@ function OnTime(timestamp)
|
||||
|
||||
if not lastTimestamp or lastTimestamp < scheduledTimestamp then
|
||||
local d = os.date('*t', scheduledTimestamp).wday
|
||||
cronJobs[i].cb(d, cronJobs[i].h, cronJobs[i].m)
|
||||
|
||||
if not pcall(cronJobs[i].cb, d, cronJobs[i].h, cronJobs[i].m) then
|
||||
print(("[^1ERROR^7] cron job at ^5%02d:%02d^7 errored, skipping it"):format(cronJobs[i].h, cronJobs[i].m))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user