Skip to content


Subversion checkout URL

You can clone with
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: NodeRedis/node_redis
head fork: NodeRedis/node_redis
  • 4 commits
  • 2 files changed
  • 0 commit comments
  • 2 contributors
Commits on Mar 13, 2012
@bnoguchi bnoguchi Add comma to package.json 5a5af9a
@bnoguchi bnoguchi Add failing test.
The test demonstrates failure for the following scenario. A single-subscription
client calls unsubscribe immediately followed by a subscribe. It will fail when
it tries to receive the next pmessage/message because the client will be in
false pub_sub_mode. Here is why it is false: First, the 2nd subscribe sets
pub_sub_mode to true during send_command. Next, the unsubscribe's
return_reply sets pub_sub_mode to false. The 2nd subscribe's return_reply does
not re-set pub_sub_mode back to true. So the result is a client with false
pub_sub_mode that fails upon receipt of the next message or pmessage.
@bnoguchi bnoguchi Add fix for last test (re-establish pub_sub_mode = true) 64a0e68
Commits on Apr 30, 2012
@mranney mranney Merge pull request #190 from bnoguchi/pub_sub_mode-fix
Pub sub mode fix
Showing with 16 additions and 0 deletions.
  1. +2 −0  index.js
  2. +14 −0 tests/re_sub_test.js
2  index.js
@@ -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
14 tests/re_sub_test.js
@@ -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');

No commit comments for this range

Something went wrong with that request. Please try again.