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
  • #600
Closed
Open
Issue created Jul 03, 2017 by Administrator@rootContributor

Remove repeatable job based on processing result

Created by: Maximization

I have a cron job that runs every x seconds. After the job is done, based on the result, I'd like the previous processing run to be the last one and remove the job from the queue. Also ideally I'd like to change the cron value based on some result output. But if I can remove the repeatable job then I could accomplish this by removing the old repeatable job and adding a new one with new cron parameters.

I've tried using job.remove() and job.discard() during the 'completed' event but that wouldn't work since it would remove the current job which has just been completed and not the next repeatable job placed in the queue when the current job was moved to active.

I've also tried changing the repeat options directly through job.opts.repeat = .. but this wouldn't work for the same reason.

What's the recommended approach here? I'd be happy to provide some code if that would help paint a clearer picture.

Assignee
Assign to
Time tracking