grantcarthew / node-rethinkdb-job-queue

A persistent job or task queue backed by RethinkDB.
https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki
MIT License
157 stars 16 forks source link

q.stop() sometimes hangs (Uncaught, unspecified "error" event) #58

Closed ebekebe closed 7 years ago

ebekebe commented 7 years ago

I wrote some tests around the queue with ava and at some point I need to stop the queue and wait for it close the database connection. Sometimes, however, q.stop() never resolves the promise and the tests time out and report the following:

{ Error: Uncaught, unspecified "error" event. ([...])
    at Queue.emit (events.js:164:17)
    at raiseQueueErrorInternal (/root/api-server/node_modules/rethinkdb-job-queue/dist/queue.js:78:14)
    at runCallback (timers.js:651:20)
    at tryOnImmediate (timers.js:624:5)
    at processImmediate [as _immediateCallback] (timers.js:596:5)
From previous event:
    at Queue.stop (/root/api-server/node_modules/rethinkdb-job-queue/dist/queue.js:245:15)
grantcarthew commented 7 years ago

The error event arguments caused an error here @ebekebe

Version 3 of the project fixed the event error handling.

That's not to say your stop error is fixed though.

Please upgrade to v3.0.0 and report back with the error if it still exists.

ebekebe commented 7 years ago

Sorry, I didn't realize there was a v3.0.0, because there is no release tag on Github for that version.

Now it seems the error is gone and my tests don't hang anymore. Thanks!

grantcarthew commented 7 years ago

@ebekebe I've deleted the old release. Are you not using npm to install?

ebekebe commented 7 years ago

I do kind of. I use the npm registry with yarn, but when I'm debugging I head to Github to look for open issues and the latest releases. I did an update of all packages a couple of days ago, to see if issues get resolved. I guess it was unlucky timing since the v3 release is only a week old.

Anyway, you boosted my confidence in your module, by replying so quickly. So thanks again for your help and your awesome module of course.

grantcarthew commented 7 years ago

@ebekebe Good stuff. Thanks mate.