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
  • #1814
Closed
Open
Issue created Jul 30, 2020 by Administrator@rootContributor

[Question] Proper way to clear entire queue?

Created by: yaboi

Description

Just curious if this is the most efficient way to clear an entire single queue of all jobs regardless of state.

It doesn't seem like .empty() or removeJobs('*') gets all jobs through my testing, but when using both it seems to consistently clear a queue. Is there a better, more sure-fire way to doing this?

Note, looping over each state and calling clean(0, state) didn't seem to clear all jobs either.

Minimal, Working Test code to reproduce the issue.

// No need to `.then()` an `await`
// await queue.pause(true).then(async () => {
//   await queue.empty()
//   await queue.removeJobs('*')
//   await queue.resume(true)
// })

await userQueue.pause(true)
await userQueue.empty()
await userQueue.removeJobs('*')
return await userQueue.resume(true)

Bull version

v3.16.0

Additional information

None

Assignee
Assign to
Time tracking