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:
_Not_
2026-08-14 19:41:00 -05:00
committed by GitHub
+4 -1
View File
@@ -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