Im running a heroku app with a background worker processing jobs with Kue. Because heroku terminates and restarts any request which takes more than 30 seconds, I ended up sending a response back to client on jobs.create()
(before it is finished).
Since some of these jobs take up to a few minutes to complete, what would be the best way to check the progress from the client?
So far the best solution I can see is to send the job id back to the client and then check the job progress every x seconds:
var job = jobs.create(type, data).save(function () {
res.send(200, job.id);
});
...
kue.Job.get(id, function (err, job) {
res.send({ progress: job._progress, state: job._state })
}