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 committed Mar 31, 2022
1 parent 2757b6c commit c1eca5c
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 c1eca5c

Please sign in to comment.