Skip to content

Jobs scheduled with Job Scheduler are not respecting group rate limit config #115

@vishuvig

Description

@vishuvig

Hi, we're seeing an issue with jobs enqueued using the job scheduler are not respecting the group rate limit config.

Code snippet to help describe the setup:

const generalPurposeQueue = newQueuePro("general-purpose", { connection });

await generalPurposeQueue.setGroupRateLimit("job-with-schedule-group", 1, 100000); // once every 100 seconds
await generalPurposeQueue.setGroupRateLimit("job-without-schedule-group", 1, 100000); // once every 100 seconds

await generalPurposeQueue.upsertJobScheduler(
  'job-scheduler',
  {
    every: 20000 // every 20 seconds
  },
  {
    name: 'job-with-schedule',
    opts: {
      group: {
        id: "job-with-schedule-group"
      }
    }
  }
);

The handler for the job-with-schedule job is fairly simple and just enqueues a new job:

...
await generalPurposeQueue.add(
  "job-without-schedule",
  {},
  {
    group: {
      id: "job-without-schedule-group"
    }
  }
);
...

Expected Behaviour

Our expectation is that both job-with-schedule and job-without-schedule should respect the group rate limit of 1 job every 100 seconds.

Actual Behaviour

❌ We see that job-with-schedule is being scheduled and run on the interval of the schedule and does not respect the rate limit set by the group.

job-without-schedule does appear to respect the rate limit config and only runs once every 100 seconds (even though it is enqueued every 20s)

We're on version 7.35.2 of bullmq-pro and version 5.53.1 of bullmq. Let me know if you have any question or anything I can clarify further.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions