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
  • #1995
Closed
Open
Issue created Mar 09, 2021 by Dimitri@dko-slapdash

The best way to abort the jobs running in the current process and release their locks before exiting

Hi. I'm trying to implement a "graceful stop" sequence for a worker process which happens when e.g. a machine is stopping. The idea is to call queue.pause(true), then wait for some reasonable amount of time (say, 10 seconds) letting most of the short-lived jobs to finish on their own. Then, there will always be some remaining jobs (long-lived) for which 10 seconds is not enough; for them, we can do nothing, so I just terminate the process.

The problem is with locks of these remaining jobs. Theoretically, I know for 100% that these jobs will stop running within a second (since the process dies), so I want the locks to be released immediately; this way, the jobs' keys can be rescheduled ASAP and not when the locks expire (due to various reasons, the locks timeouts are set to some high value, like 60 seconds, to eliminate the chances of expiring them during some temporary problems with CPU load or network).

Is there a way to tell Bull to force-release locks for all the jobs which are still running in the current (!) process?

Assignee
Assign to
Time tracking