-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat: scheduling jobs #12863
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: scheduling jobs #12863
Conversation
… calling db.createGlobal
…terwards
Excited for this PR! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just have some questions.
* | ||
* @default 'manual' | ||
*/ | ||
scheduler?: 'cron' | 'manual' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does the 'manual' option do in the code? If it is cron we run the cron schedule, but otherwise the endpoints are just available?
I'm trying to move quick on reviewing this so maybe I'm missing something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it is cron we run the cron schedule, but otherwise the endpoints are just available?
Correct - well, the endpoints are always available. If it is set to cron
, we create cronjobs on init to handle scheduling. If it is manual, we do not.
An error is thrown if this is explicitly set and schedules are used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this is effectively the same?
scheduler: 'manual'
// scheduler: 'manual'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct - had it required explicitly like this to ensure the user thinks about what scheduler mode they want to use.
Hey @AlessioGr any ETA on merging this one? It's crucial to one of my projects 😀 |
📦 esbuild Bundle Analysis for payloadThis analysis was generated by esbuild-bundle-analyzer. 🤖
Largest pathsThese visualization shows top 20 largest paths in the bundle.Meta file: packages/next/meta_index.json, Out file: esbuild/index.js
Meta file: packages/payload/meta_index.json, Out file: esbuild/index.js
Meta file: packages/payload/meta_shared.json, Out file: esbuild/exports/shared.js
Meta file: packages/richtext-lexical/meta_client.json, Out file: esbuild/exports/client_optimized/index.js
Meta file: packages/ui/meta_client.json, Out file: esbuild/exports/client_optimized/index.js
Meta file: packages/ui/meta_shared.json, Out file: esbuild/exports/shared_optimized/index.js
DetailsNext to the size is how much the size has increased or decreased compared with the base branch of this PR.
|
…ecting other tests
…have random auto scheduled jobs in the background in this specific test suite
Can't wait to try it out! |
I have updated to the latest version, but adding the Version used: "payload": "3.48.0", |
This enables us to do a lot of great things. Thank you! Now it should be trivial to throttle large amounts of background jobs, instead of having to wait a whole minute between each batch. |
Love you @AlessioGr ❤️ |
Solves #11611 and #12965
Adds a new
schedule
property to workflow and task configs that can be used to have Payload automatically queue jobs following a certain schedule.Docs: https://payloadcms.com/docs/jobs-queue/schedules
API Example