node-persistent-queue
node-persistent-queue copied to clipboard
Calling done() sometimes throws an error
I've noticed what seems like an intermittent problem (no solid repro) around calling the done method on a queue.
Error occurred:
TypeError: Cannot read property 'id' of undefined
at removeJob (/Users/sunegynthersen/repositories/subscription-billing/node_modules/node-persistent-queue/index.js:605:23)
at PersistentQueue.done (/Users/sunegynthersen/repositories/subscription-billing/node_modules/node-persistent-queue/index.js:334:2)
at axios.get.then (/Users/sunegynthersen/repositories/subscription-billing/index-process.js:50:19)
I'm using node-persistent-queue version 1.0.2. Initially I saw it on version 0.3.1, but upgrading didn't seem to help.
Looking at the line that throws the error, my interpretation is that the item is actually taken of the queue, but attempting to find the Id fails, that halts execution.
id = q.queue.shift().id ;
If that is the case, it also means that restarting/continuing should be okay.
Repro None, so far. Continuing processing items on the queue (by starting the process again) does not throw the exception again.