1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00

Issue #439 (and others): Stop assuming all "message" or "pmessage" replies are pubsub replies. Check pub_sub_mode as well.

This commit is contained in:
Bryce Baril
2013-10-02 14:04:28 -07:00
parent 520ed070d6
commit 5f125b51d4
3 changed files with 22 additions and 1 deletions

View File

@@ -14,6 +14,12 @@ var net = require("net"),
// can set this to true to enable for all connections
exports.debug_mode = false;
var arraySlice = Array.prototype.slice
function trace() {
if (!exports.debug_mode) return;
console.log.apply(null, arraySlice.call(arguments))
}
// hiredis might not be installed
try {
require("./lib/parser/hiredis");
@@ -602,7 +608,10 @@ RedisClient.prototype.return_reply = function (reply) {
type = reply[0].toString();
}
if (type !== 'message' && type !== 'pmessage') {
if (this.pub_sub_mode && (type == 'message' || type == 'pmessage')) {
trace("received pubsub message");
}
else {
command_obj = this.command_queue.shift();
}