Promise warning on dt.confirm
Keep getting this warning on Promise... May be coming from inside the library... I get this if I use confirm method...
(node:149536) Warning: a promise was created in a handler at net.js:607:20 but was not returned from it, see http://goo.gl/rRqMUw
at RedisClient.ret [as timeAsync] (eval at makeNodePromisifiedEval ( node_modules\bluebird\js\release\promisify.js:184:12),
I see this warning in my unit tests also when I set the bluebird warnings to true, but I am not sure about the cause of the warning.
In my tests, too, the warnings occur inside dt.confirm() method. I realize, the call is made on the event 'event', and dt.confirm() is the only one that is called on the event in my tests.
So, I tried to delay the emission of the event using process.nextTick(), then warnings were gone. I still have no idea why that is, but at least there's a way to get around the warning.
diff --git a/lib/dtimer.js b/lib/dtimer.js
index 4bd256a..ca31996 100644
--- a/lib/dtimer.js
+++ b/lib/dtimer.js
@@ -424,7 +424,9 @@ DTimer.prototype._onTimeout = function () {
debug(self._id+': fail to parse event. ' + JSON.stringify(e));
return;
}
- self.emit('event', ev);
+ process.nextTick(function () {
+ self.emit('event', ev);
+ });
});
}
}, function (err) {
The above change is reasonable, but the warning might just be spurious (harmless). Let me think about it a bit more before deciding what to do.
@ubreddy, If you have a chance, try this branch bugfix/issue_16 and let me know if that works for you.