meteor-job-collection
meteor-job-collection copied to clipboard
Update job delay
If I create a job with a two-hour delay, and an hour later wish to add an extra hour of delay, what is the best way to accomplish that?
job.pause()
job.delay(<new delay>)
job.save()
job.resume()
Of course the above answer doesn't really answer the details of how to add an "extra hour" specifically... :-)
job.doc.after
contains a Date
representing the time after which the job can run (calculated from the job.delay()
/ job.after()
at the time the job was created). If you'd like to add an additional hour to the original delay, you can do so as:
job.pause()
job.after(new Date(job.doc.after.setHours(job.doc.after.getHours()+1)))
job.save()
job.resume()