There are three pieces to this support, all of them small, and none of
them with large overhead:
1. When sending a command, ensure that any callback is bound to the
current domain, if one is present.
2. Also add the RedisClient to the current domain so that error
events bubble properly.
3. In try_callback, when a domain is in play, instead of throwing
on the next tick, emit the error on the domain. The parser can
still finish processing the response and the error ends up in
the correct place.
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>