payloadcms / payloadcms/payload
In the job types, the cron example is wrong
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 44.8k
- Forks
- 4.2k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 53
Description
Documentation Issue
In AutorunCronConfig, this is the jsdoc comment for the cron field: [source]
export type AutorunCronConfig = {
/**
* The cron schedule for the job.
* @default '* * * * *' (every minute).
*
* @example
* ┌───────────── (optional) second (0 - 59)
* │ ┌───────────── minute (0 - 59)
* │ │ ┌───────────── hour (0 - 23)
* │ │ │ ┌───────────── day of the month (1 - 31)
* │ │ │ │ ┌───────────── month (1 - 12)
* │ │ │ │ │ ┌───────────── day of the week (0 - 6) (Sunday to Saturday)
* │ │ │ │ │ │
* │ │ │ │ │ │
* - '* 0 * * * *' every hour at minute 0
* - '* 0 0 * * *' daily at midnight
* - '* 0 0 * * 0' weekly at midnight on Sundays
* - '* 0 0 1 * *' monthly at midnight on the 1st day of the month
* - '* 0/5 * * * *' every 5 minutes
* - '* * * * * *' every second
*/
cron?: string
}
All the examples have a * in seconds place. However, that means "run every second", hence all the descriptions are wrong.
| cron | description | actual meaning |
|---|---|---|
| * 0 * * * * | ❌ every hour at minute 0 | every second, at 0 minutes past the hour |
| * 0 0 * * * | ❌ daily at midnight | every second between 12:00 AM and 12:01 AM |
| * 0 0 * * 0 | ❌ weekly at midnight on Sundays | every second between 12:00 AM and 12:01 AM, only on Sunday |
| * 0 0 1 * * | ❌ monthly at midnight on the 1st day of the month | every second between 12:00 AM and 12:01 AM, on day 1 of the month |
| * 0/5 * * * * | ❌ every 5 minutes | every second, on minutes divisible by 5 |
| ✅ every second | every second |
The correct examples should have 0 in the seconds place, except for the last one.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open packages/payload/src/queues/config/types/index.ts and review the JSDoc examples for AutorunCronConfig and ScheduleConfig. Change the seconds field in the scheduled examples to 0 while keeping the every-second example unchanged, then verify that each description matches its six-field cron expression.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100