Skip to content

[Bug?]: Bad syntax in background job documentation #12038

@tctrautman

Description

@tctrautman

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:

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:

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)

Are you interested in working on this?

  • I'm interested in working on this

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug/needs-infoMore information is needed for reproduction

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions