Skip to content

Commit af60bb0

Browse files
committedMar 19, 2022
fix: pipeline fails when cluster is not ready
Closes #1460
1 parent 247f86d commit af60bb0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed
 

‎lib/Pipeline.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,15 @@ Pipeline.prototype.exec = function (callback: Callback): Promise<Array<any>> {
263263
// Wait for the cluster to be connected, since we need nodes information before continuing
264264
if (this.isCluster && !this.redis.slots.length) {
265265
if (this.redis.status === "wait") this.redis.connect().catch(noop);
266+
267+
if (callback && !this.nodeifiedPromise) {
268+
this.nodeifiedPromise = true;
269+
asCallback(this.promise, callback);
270+
}
271+
266272
this.redis.delayUntilReady((err) => {
267273
if (err) {
268-
callback(err);
274+
this.reject(err);
269275
return;
270276
}
271277

0 commit comments

Comments
 (0)
Please sign in to comment.