Skip to content

option to wait for callbacks completion on job.stop() #713

@YannHulot

Description

@YannHulot

⭐ Suggestion

Do not stop the jobs if the onTick function is being executed. Wait for this function to resolve first and then, resolve job.stop()

💻 Use Cases

Basically I am trying to gracefully shut down my cron jobs when deploying a new version of my back-end.

That means that ideally, I want to call job.stop() on all the ongoing jobs, Then once they are done, I want to close the DB connection and so on and so forth.

The problem is that those jobs are mostly doing async stuff, so if I call a job.stop() and my onTick function is currently running, then, I would like to wait for the onTick function to resolve before the job.stop() function resolves itself so I don't close the DB connection before those jobs are done since they need it.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomershacktoberfestThis issue is registered for Hacktoberfest!help wantedExtra attention is neededreleasedstatus:readyReady to start implementationtype:featureNew feature or feature improvement & requests

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions