Skip to content

Commit

Permalink
fix: pipeline fails when cluster is not ready
Browse files Browse the repository at this point in the history
Closes #1460
  • Loading branch information
luin committed Mar 19, 2022
1 parent 247f86d commit af60bb0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/Pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,15 @@ Pipeline.prototype.exec = function (callback: Callback): Promise<Array<any>> {
// Wait for the cluster to be connected, since we need nodes information before continuing
if (this.isCluster && !this.redis.slots.length) {
if (this.redis.status === "wait") this.redis.connect().catch(noop);

if (callback && !this.nodeifiedPromise) {
this.nodeifiedPromise = true;
asCallback(this.promise, callback);
}

this.redis.delayUntilReady((err) => {
if (err) {
callback(err);
this.reject(err);
return;
}

Expand Down

0 comments on commit af60bb0

Please sign in to comment.