Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B bull
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 175
    • Issues 175
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 9
    • Merge requests 9
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OptimalBits
  • bull
  • Issues
  • #1731
Closed
Open
Issue created May 11, 2020 by Administrator@rootContributor

addBulk does not work with repeatable jobs

Created by: jtassin

Description

addBulk function does not work properly for repeatable jobs, the nextRepeatableJob is not invoked for repeatable jobs.

Minimal, Working Test code to reproduce the issue.

(An easy to reproduce test case will dramatically decrease the resolution time.)

The following code :

imgQueue.addBulk([{ data: { img }, opts: {repeatable: { every: 5_000 }}}])

is different than :

imgQueue.add({ img }, {repeatable: { every: 5_000 }})

In the add code we have this behaviour once the job is created :

if (opts.repeat) {
  return this.isReady().then(() => {
    return this.nextRepeatableJob(name, data, opts, true);
  });
} 

It is missing in the addBulk function.

Solutions

I'm OK to fix it. Here are two possible solutions :

  • forbid addBulk for repeatable jobs it could sounds weird to bulk add repeatable jobs, but it is kind of breaking
  • call nextRepeatableJob for each repeatable jobs of the batch once created. Bad for perfs but still better than multiple adds

which one do you prefer ?

Bull version

3.14

Additional information

Thx for your lib :)

Assignee
Assign to
Time tracking