Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then(nodes => {
if (this.connectionEpoch !== epoch) {
debug(
"discard connecting after resolving startup nodes because epoch not match: %d != %d",
epoch,
this.connectionEpoch
);
reject(
new RedisError(
"Connection is discarded because a new connection is made"
)
);
return;
}
if (this.status !== "connecting") {
debug(
"discard connecting after resolving startup nodes because the status changed to %s",
this.status
);
reject(new RedisError("Connection is aborted"));
return;
}
this.connectionPool.reset(nodes);
function readyHandler() {
epoch,
this.connectionEpoch
);
reject(
new RedisError(
"Connection is discarded because a new connection is made"
)
);
return;
}
if (this.status !== "connecting") {
debug(
"discard connecting after resolving startup nodes because the status changed to %s",
this.status
);
reject(new RedisError("Connection is aborted"));
return;
}
this.connectionPool.reset(nodes);
function readyHandler() {
this.setStatus("ready");
this.retryAttempts = 0;
this.executeOfflineCommands();
this.resetNodesRefreshInterval();
resolve();
}
let closeListener: () => void;
const refreshListener = () => {
this.removeListener("close", closeListener);
this.manuallyClosing = false;