You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
Merge pull request #190 from bnoguchi/pub_sub_mode-fix
Pub sub mode fix
This commit is contained in:
2
index.js
2
index.js
@@ -570,6 +570,8 @@ RedisClient.prototype.return_reply = function (reply) {
|
|||||||
if (this.debug_mode) {
|
if (this.debug_mode) {
|
||||||
console.log("All subscriptions removed, exiting pub/sub 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
|
// 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
|
// TODO - document this or fix it so it works in a more obvious way
|
||||||
|
14
tests/re_sub_test.js
Normal file
14
tests/re_sub_test.js
Normal file
@@ -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');
|
Reference in New Issue
Block a user