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

Merge branch 'jeffbski-0.8.2-unsub-empty'

This commit is contained in:
Bryce Baril
2013-04-27 08:23:45 -07:00
2 changed files with 48 additions and 2 deletions

View File

@@ -634,10 +634,12 @@ RedisClient.prototype.return_reply = function (reply) {
}
// subscribe commands take an optional callback and also emit an event, but only the first response is included in the callback
// TODO - document this or fix it so it works in a more obvious way
// reply[1] can be null
var reply1String = (reply[1] === null) ? null : reply[1].toString();
if (command_obj && typeof command_obj.callback === "function") {
try_callback(command_obj.callback, reply[1].toString());
try_callback(command_obj.callback, reply1String);
}
this.emit(type, reply[1].toString(), reply[2]); // channel, count
this.emit(type, reply1String, reply[2]); // channel, count
} else {
throw new Error("subscriptions are active but got unknown reply type " + type);
}