generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: rewrite cron to use async system (#2407)
This refactor removes the cron job system's state management, cron execution, and hashring management, in favor of the async call system. Data tables changed as follows: - `cron_jobs` is still used to maintain the job list - Removes `state`, adds `last_execution::timestampz` and `last_async_call_id::bigint` - `async_calls` is inserted to by the cron system - `cron_jobs.last_async_call_id = async_calls.id` - Adds the notion of a `cron` origin in `async_calls.origin` After a deployment, all valid unscheduled cron jobs are scheduled; a row is added to `async_calls` with a `pending` state and `scheduled_at` is set to the job's next execution time. The corresponding row in `cron_jobs` is also updated with the scheduled async call, the computed next execution time, and the inserted async call ID. On completion of a cron async call, the next execution of that job is scheduled. Effectively, every cron job will have exactly one scheduled execution. Closes #2197 --------- Co-authored-by: Alec Thomas <[email protected]>
- Loading branch information
1 parent
a60bce5
commit 8ce9faf
Showing
32 changed files
with
992 additions
and
1,602 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.