ioredis 5.8.0 → 5.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -158,9 +158,27 @@ class ClusterSubscriber {
|
|
|
158
158
|
let pending = 0;
|
|
159
159
|
for (const type of ["subscribe", "psubscribe", "ssubscribe"]) {
|
|
160
160
|
const channels = previousChannels[type];
|
|
161
|
-
if (channels.length) {
|
|
161
|
+
if (channels.length == 0) {
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
debug("%s %d channels", type, channels.length);
|
|
165
|
+
if (type === "ssubscribe") {
|
|
166
|
+
for (const channel of channels) {
|
|
167
|
+
pending += 1;
|
|
168
|
+
this.subscriber[type](channel)
|
|
169
|
+
.then(() => {
|
|
170
|
+
if (!--pending) {
|
|
171
|
+
this.lastActiveSubscriber = this.subscriber;
|
|
172
|
+
}
|
|
173
|
+
})
|
|
174
|
+
.catch(() => {
|
|
175
|
+
// TODO: should probably disconnect the subscriber and try again.
|
|
176
|
+
debug("failed to ssubscribe to channel: %s", channel);
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
162
181
|
pending += 1;
|
|
163
|
-
debug("%s %d channels", type, channels.length);
|
|
164
182
|
this.subscriber[type](channels)
|
|
165
183
|
.then(() => {
|
|
166
184
|
if (!--pending) {
|