option to wait for callbacks completion on job.stop() #713
Labels
good first issue
Good for newcomers
hacktoberfest
This issue is registered for Hacktoberfest!
help wanted
Extra attention is needed
status:ready
Ready to start implementation
type:feature
New feature or feature improvement & requests
β Suggestion
Do not stop the jobs if the
onTick
function is being executed. Wait for this function to resolve first and then, resolvejob.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 myonTick
function is currently running, then, I would like to wait for theonTick
function to resolve before thejob.stop(
) function resolves itself so I don't close the DB connection before those jobs are done since they need it.Related
The text was updated successfully, but these errors were encountered: