Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,8 @@ RedisClient.prototype.return_reply = function (reply) {
if (this.debug_mode) {
console.log("All subscriptions removed, exiting pub/sub mode");
}
} else {
this.pub_sub_mode = true;
}
// 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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
},
"optionalDependencies": {
"hiredis": "*"
}
},
"repository": {
"type": "git",
"url": "git://github.com/mranney/node_redis.git"
Expand Down
14 changes: 14 additions & 0 deletions tests/re_sub_test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
var client = require('../index').createClient()
, client2 = require('../index').createClient()
, assert = require('assert');

client.once('subscribe', function (channel, count) {
client.unsubscribe('x');
client.subscribe('x', function () {
client.quit();
client2.quit();
});
client2.publish('x', 'hi');
});

client.subscribe('x');