Created by: albertjan
This tries to resolve the easy to make mistake with specifying a handler with a callback and returning a promise.
It's a bit intricate but it does the job
This will make these work:
queue.process(function(job, done) {
return Promise.resolve();
});
and
queue.process(function(job, done) {
return 5;
});
This one will probably create a race condition (for as far as possible in js):
queue.process(function(job, done) {
done(5);
return Promise.resolve(6);
});
And this one will outright not work for obvious reasons:
queue.process(function(job, done) {
setTimeout(done, 500);
return 4;
});