#12038·graphql

[Bug?]: Bad syntax in background job documentation

Author: tctrautmanCreated Apr 18, 2025Updated Apr 20, 2025
Labelsbug/needs-info

What's not working?

Hi, I believe there are syntax errors in the highlighted lines of code within this section of the documentation.

I believe that this:

bash
import { later, jobs } from 'src/lib/jobs'

export const NightlyReportJob = jobs.createJob({
  queue: 'default',
  perform: async () => {
    await DailyUsageReport.run()
    await later(NightlyReportJob, [], {
      wait: new Date(new Date().getTime() + 86_400 * 1000),
    })
  },
})

Should be this, since wait expects a number instead of a Date:

bash
import { later, jobs } from 'src/lib/jobs'

export const NightlyReportJob = jobs.createJob({
  queue: 'default',
  perform: async () => {
    await DailyUsageReport.run()
    await later(NightlyReportJob, [], {
      wait: 86_400 * 1000,
    })
  },
})

I'm pretty sure this is correct because, while trying to debug another issue, I attempted to pass along a date to wait and received an error.

How do we reproduce the bug?

No response

What's your environment? (If it applies)

bash

Are you interested in working on this?

  • I'm interested in working on this