Skip to content

[Bug]: immediately on upsertJobScheduler kicks in multiple times with pattern. #2860

Closed
@vorillaz

Description

@vorillaz

Version

5.21.2

Platform

NodeJS

What happened?

According to the docs the immediately option on upsertJobScheduler kicks in the worker instantly once registered, but once using a cron pattern along with immediately the worker starts processing multiple times in a row, from 20 to 30 times during my tests. As an additional information, according to my tests limit option actually the kick in.

How to reproduce.

Take the docs sample along with a test worker:

const worker = async () => {
  console.log('workkkkkkks again');
};
await myQueue.upsertJobScheduler(
  "end-soon-job",
  {
    every: 60000, // every minute
    immediately: true,
  },
  {
    name: "timed-end-job",
    opts: {
      attempts: 0,
      removeOnComplete: 5,
      removeOnFail: 20,
    },
  }
);

Once changing the every property to cron pattern the worker kicks in multiple times:

await myQueue.upsertJobScheduler(
  "end-soon-job",
  {
    pattern: '* * * * *', // every minute in cron
    immediately: true,
  },
  {
    name: "timed-end-job",
    opts: {
      attempts: 0,
      removeOnComplete: 5,
      removeOnFail: 20,
    },
  }
);

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions