Commit Graph

20 Commits

Author SHA1 Message Date
_Not_ 4dd4c9c8ca Merge pull request #1839 from seltonmt012/fix/cron-callback-guard
fix(cron): keep the scheduler alive when a job errors
2026-08-14 19:41:00 -05:00
Selt 1b5e29c62b fix(cron): build the scheduled time from the day the job belongs to
OnTime always built scheduledTimestamp from the date of the current tick, so
a tick that skipped the 23:59 minute compared it against 23:59 of the next
day. The run was dropped without a trace. Fall back to the previous day when
the scheduled time lands in the future.
2026-07-28 00:44:30 +02:00
Selt f98a6e2245 fix(cron): keep the scheduler alive when a job errors
Registered jobs are third party callbacks and were invoked bare. An error inside
one propagates out of OnTime into Tick, so Tick never reaches its
SetTimeout(60000, Tick) at the end and nothing ever reschedules it. From that
moment cron is dead for every resource on the server - paychecks, cleanups,
anything registered through cron:runAt - until a restart. The operator sees one
stack trace and then silence.

Wrapping the callback keeps the loop and the reschedule intact, and names the job
that failed.

Simulated the scheduler chain in standalone Lua with three jobs where the first
raises: before, the tick died before SetTimeout and the two later jobs never ran
again; after, the failure is reported and both later jobs fire.
2026-07-27 21:17:12 +02:00
Ilias Rbayti 0576b20967 validate serialized function references 2024-11-15 15:28:45 +01:00
Ilias Rbayti 6b91207cc9 refactor(cron/server/main): Add more type annotations 2024-11-14 12:33:35 +01:00
Ilias Rbayti b69385fff6 refactor(cron/server/main): More appropriate variable names 2024-11-14 12:29:48 +01:00
Ilias Rbayti 4bb69c15e8 refactor(cron/server/main): Add type annotations 2024-11-14 12:26:39 +01:00
Ilias Rbayti 1aae1970a3 refactor/cron/server/main): Validate event params 2024-11-14 12:21:24 +01:00
Summer 459f44d5e1 Fix minute not working, put back day check 2024-11-05 16:45:45 +08:00
Gellipapa 9d90c9d674 🎨 Run formatter 2024-01-24 23:07:30 +01:00
Thekuca 48c9662377 fix(cron): fix unused args 2023-08-17 00:07:39 +02:00
ItsKuf ea14a80fa0 🚀 Enhanced ESX Core Cron Task Handling
Description:
This commit brings substantial enhancements to the time handling functionality in the 'esx_core/[core]/cron/server/main.lua' script for the FiveM server:

- Utilized Unix Timestamps: Replaced the existing `GetTime()` function with `GetUnixTimestamp()`, ensuring precise time representation by using the Unix timestamp format (seconds since January 1, 1970). This change mitigates potential issues related to Daylight Saving Time (DST) transitions.

- Refined Task Execution Logic: The `OnTime` function has been refactored to operate based on Unix timestamps, ensuring accurate execution of scheduled tasks without any inconsistencies due to local time conversions.

By introducing these improvements, the cron-like system now operates with enhanced accuracy, bolstering the stability and predictability of scheduled events on the FiveM server. Extensive testing has been conducted to guarantee compatibility with various server environments.
2023-07-26 09:52:33 +01:00
TheFantomas 9049c98d76 formatting(all): Format with prettier and lua formatter 2023-07-09 17:00:36 +02:00
TheFantomas 88c8036a24 formatting(core): Format all 2023-06-29 20:20:28 +02:00
Tomić eaa27d0ac4 feat(Client): GetAccount method
- Minor code refactoring
- Return nil on the server if the account isn't fount (self.getAccount)
2023-05-08 10:00:17 +02:00
TheFantomas ddaf99f9a4 fix(cron/server/main.lua): Fixed mistake.... 2023-03-15 15:43:55 +01:00
Thekuca a7a3b77f05 refactor(cron/server/main): Micro change 2023-03-14 11:24:19 +01:00
Benzo db983b931c move everything into core folder 2023-01-18 15:21:39 +01:00
Benzo 9f36559ac0 Revert "build: new repos"
This reverts commit cfb8e742e4.
2023-01-18 15:08:44 +01:00
Benzo cfb8e742e4 build: new repos 2023-01-18 15:06:15 +01:00