Closed satblip closed 9 years ago
@satblip Your code looks right. Could you insert a console.log in your node_modules/redis-lock/index.js before line 43 to check what the value of done
is? It should be equal to the function you are passing into the lock
function. If it isn't, that's your bug.
It certainly seems from the error message that what's getting passed in isn't a function, but an object of some sort.
Hi,
I've found the issue, it was indeed on my side. I did correct it like this :
lock('workerLock', function (done) {
return Promise.join(
dailyWorker()
).spread(function (daily, monthly) {
return saveToDb(daily, monthly);
})
.then(function () {
done();
setTimeout(mainWorker, 1000));
})
.catch(function (err) {
logger.error(err.stack, 'error');
});
});
I run a worker that consume a queue.
I works quite well, but sometimes trough me this error, any idea?
This is the code for the lock part:
Thanks!