When unsubscribe or punsubscribe is called
and there is nothing to unsubscribe from, the reply[1]
argument is a null which causes a TypeError
Cannot call method 'toString' of null
```
TypeError: Cannot call method 'toString' of null
at RedisClient.return_reply (/Users/barczewskij/projects/node_redis/index.js:633:65)
at ReplyParser.RedisClient.init_parser (/Users/barczewskij/projects/node_redis/index.js:266:14)
at ReplyParser.EventEmitter.emit (events.js:96:17)
at ReplyParser.send_reply (/Users/barczewskij/projects/node_redis/lib/parser/javascript.js:300:10)
at ReplyParser.execute (/Users/barczewskij/projects/node_redis/lib/parser/javascript.js:211:22)
at RedisClient.on_data (/Users/barczewskij/projects/node_redis/index.js:483:27)
at Socket.<anonymous> (/Users/barczewskij/projects/node_redis/index.js:82:14)
at Socket.EventEmitter.emit (events.js:96:17)
at TCP.onread (net.js:396:14)
```
Reverting because this was a documentation problem, not a problem with
the code. Performance-wise, this is faster than the approach in #345, though
it may cause users more trouble. This is okay, if someone opens an issue we
can point them to the docs.
This reverts commit b60e001fa0.
Conflicts:
index.js
test.js
This fixes an issue where the command queue gets popped prematurely by pubsub
messages, leading to callbacks for those commands not being invoked.
Close#360.
Signed-off-by: DTrejo <david.daniel.trejo@gmail.com>
Also adds a test that uses SADD in caps. Nicely enough, this makes
multi_bench.js run just a tiny bit faster :)
Signed-off-by: DTrejo <david.trejo@voxer.com>
This change stores the connection state regarding subscriptions,
selected db and monitoring. When the connection to Redis drops, the state
is reestablished after a succesful reconnect. Fixes#241. Fixes#210.
Signed-off-by: DTrejo <david.trejo@voxer.com>
Tests for a bug where the client unsubscribes
and then subscribes to a single channel. If the
subscription is sent before the response to the
unsubscribe is received, then the client would
leave pubsub mode when it received the unsubscribe
response and then fail to enter when the subsequent
subscription is processed. This is another test for #190:
https://github.com/mranney/node_redis/pull/190
Signed-off-by: David Trejo <david.daniel.trejo@gmail.com>