payload icon indicating copy to clipboard operation
payload copied to clipboard

Schedule publish saves time with milliseconds from current date

Open markusahrweileramcon opened this issue 8 months ago • 0 comments

Describe the Bug

When you schedule a publish for let's say 2:20 PM, and then check the database, you will have milliseconds more than 0. Which means, that this job is executed on the next schedule instead of at the designated time

Link to the code that reproduces this issue

https://github.com/payloadcms/public-demo

Reproduction Steps

Add Job Configuration as described in the docs:

 jobs: {
        access: {
            run: ({ req }: { req: PayloadRequest }): boolean => {
                if (req.user) {
                    return true
                }
                const authHeader = req.headers.get('authorization')
                return authHeader === `Bearer ${ process.env.CRON_SECRET }`
            }
        },
        autoRun: [
            {
                cron: '0/5 * * * *',
                limit: 100,
                queue: 'default',
            }
        ],
        shouldAutoRun: ({ logger }) => {

            logger.info('cron triggered')
            return true
        }
    }
  • Create a page and add a schedule to publish at any time in the future
  • Check the database. The time will have a millisecond other than zero

Which area(s) are affected? (Select all that apply)

area: ui, Not sure

Environment Info

Binaries:
  Node: 22.13.0
  npm: N/A
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  payload: 3.38.0
Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Pro
  Available memory (MB): 32421
  Available CPU cores: 20

markusahrweileramcon avatar May 27 '25 12:05 markusahrweileramcon