Skip to content

Commit

Permalink
fix: Fix failover detector with sentinel and tls streams
Browse files Browse the repository at this point in the history
  • Loading branch information
marcbachmann authored and luin committed Mar 31, 2022
1 parent 14f03a4 commit ac00a00
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/connectors/SentinelConnector/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,16 @@ export default class SentinelConnector extends AbstractConnector {
resolved.port,
endpointAddress
);

if (this.options.enableTLSForSentinelMode && this.options.tls) {
Object.assign(resolved, this.options.tls);
this.stream = createTLSConnection(resolved);
this.stream.once("secureConnect", this.initFailoverDetector.bind(this));
} else {
this.stream = createConnection(resolved);
this.stream.once("connect", this.initFailoverDetector.bind(this));
}

this.stream.once("connect", () => this.initFailoverDetector());

this.stream.once("error", (err) => {
this.firstError = err;
});
Expand Down

0 comments on commit ac00a00

Please sign in to comment.