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
  • #1532
Closed
Open
Issue created Oct 31, 2019 by Administrator@rootContributor

Passing doNotWaitActive=true to queue.pause means queue won't actually be paused

Created by: gabegorelick

Description

queue.pause has an option called doNotWaitActive. I believe the intention is that when this is set to true, pause will not wait for any active jobs to finish before resolving. But I would still expect no new jobs to be processed.

Internally, doNotWaitActive=true means pause will not call whenCurrentJobsFinished. But whenCurrentJobsFinished is where we stop polling for new jobs: https://github.com/OptimalBits/bull/blob/146bc8ed4341ec3e54b299c22e60dc3267d8b6d1/lib/queue.js#L1176-L1178

Thus, without calling whenCurrentJobsFinished, the queue isn't really paused: a job added after queue.pause(true, true) will be processed.

Minimal, Working Test code to reproduce the issue.

queue.process(job => { throw new Error('Job should not be processed'); });

// I don't want to process any more jobs,
// but I want to let any active jobs finish without waiting for them
await queue.pause(true, true);

await queue.add('foo', {});

Bull version

3.11.0

Assignee
Assign to
Time tracking