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
156 stars 16 forks source link

Promise not being returned #41

Closed bslayton closed 7 years ago

bslayton commented 7 years ago

I get this error when starting a basic sub, using nodejs version 6.1.0

(node:74430) Warning: a promise was created in a handler at Users/Ben/Code/Swagger2/node_modules/rethinkdb-job-queue/dist/queue-db.js:24:29 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/Users/Ben/Code/Swagger2/node_modules/bluebird/js/release/promise.js:77:14)

On line 24 in the file referenced queue-db.js, if you add a return before the promise, you're good to go.

I don't think something this trivial warrants a PR. Nonetheless, if you want it in a PR, i'd be glad to submit one.

grantcarthew commented 7 years ago

Hi @bslayton. Thanks for reporting this.

I am not getting the error here so it is a little hard to know exactly where the return statement is required. Can you please highlight which line/location a return is required?

If you go into your node_modules directory and add the return does it fix it? Where did you add it?

bslayton commented 7 years ago

Sorry. It looks like master is ahead of the NPM version. In the current master, it's line 28.

https://github.com/grantcarthew/node-rethinkdb-job-queue/blob/f92f4897c2de3dea853e23315cb34485af34d4c6/src/queue-db.js#L28

Adding return on that line, like so, fixes it. return q._changeFeedCursor.each(function (err, change) { fixes it.

grantcarthew commented 7 years ago

You ripper, thanks @bslayton. It's fixed in master and will be published with v2.

grantcarthew commented 7 years ago

I'll leave this open till v2 is published.

grantcarthew commented 7 years ago

Fixed in v2.0.