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 it has
no subscriptions, the reply[1] is a null which causes
`TypeError: Cannot call method 'toString' of null`
Check if reply[1] is null before calling toString otherwise
just pass null.
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>
RedisClient might enter pub/sub mode after at least one SELECT command issued.
When reconnecting, the SELECT command is issued after restoring pub_sub_command to true, which causes an exception.
An uncaught exception will be raised when the retry timer tries to
reconnect and encounter an error, for all event listeners of the stream
were removed in line 826. It should set closing varable to be true.
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>