Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Trigger ready event in pub/sub mode when no subscribe related commands issued before #351

Closed
wants to merge 1 commit into from

1 participant

@roamm

This issue occurs when only PUBLISH command sent. After reconnection succeeds, ready event won't be fired.

@roamm roamm closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 19, 2012
  1. @roamm
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 1 deletion.
  1. +5 −1 index.js
View
6 index.js
@@ -286,7 +286,7 @@ RedisClient.prototype.on_ready = function () {
}
if (this.pub_sub_mode === true) {
// only emit "ready" when all subscriptions were made again
- var callback_count = 0;
+ var callback_count = 0, trigger_ready = true;
var callback = function () {
callback_count--;
if (callback_count === 0) {
@@ -298,9 +298,13 @@ RedisClient.prototype.on_ready = function () {
if (exports.debug_mode) {
console.warn("sending pub/sub on_ready " + parts[0] + ", " + parts[1]);
}
+ trigger_ready = false;
callback_count++;
self.send_command(parts[0] + "scribe", [parts[1]], callback);
});
+ if (trigger_ready) {
+ this.emit("ready");
+ }
return;
} else if (this.monitoring) {
this.send_command("monitor");
Something went wrong with that request. Please try again.