diff --git a/lib/autoPipelining.ts b/lib/autoPipelining.ts index 7ae0e7d33..858200bf1 100644 --- a/lib/autoPipelining.ts +++ b/lib/autoPipelining.ts @@ -121,22 +121,24 @@ export function executeWithAutoPipelining( // On cluster mode let's wait for slots to be available if (client.isCluster && !client.slots.length) { if (client.status === "wait") client.connect().catch(noop); - return new CustomPromise(function (resolve, reject) { - client.delayUntilReady((err) => { - if (err) { - reject(err); - return; - } - - executeWithAutoPipelining( - client, - functionName, - commandName, - args, - callback - ).then(resolve, reject); - }); - }); + return asCallback( + new CustomPromise(function (resolve, reject) { + client.delayUntilReady((err) => { + if (err) { + reject(err); + return; + } + + executeWithAutoPipelining( + client, + functionName, + commandName, + args + ).then(resolve, reject); + }); + }), + callback + ); } // If we have slot information, we can improve routing by grouping slots served by the same subset of nodes