File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -77,17 +77,22 @@ export class RedisNotifier {
77
77
}
78
78
79
79
// Redis Cluster configuration
80
- if ( process . env . REDIS_CLUSTER_NODES ) {
81
- const clusterNodes = process . env . REDIS_CLUSTER_NODES . split ( ',' ) ;
80
+ if ( process . env . REDIS_CLUSTER_NODES && process . env . REDIS_CLUSTER_NODES . length > 0 ) {
81
+ let isSRVRecord = false ;
82
+ const clusterNodesArray = process . env . REDIS_CLUSTER_NODES . split ( ',' ) ;
83
+ if ( clusterNodesArray . length === 1 ) {
84
+ isSRVRecord = true ;
85
+ }
82
86
logger . info (
83
87
`RedisNotifier connecting to redis cluster at ${ process . env . REDIS_CLUSTER_NODES } `
84
88
) ;
85
- return new Redis . Cluster ( clusterNodes , {
89
+ return new Redis . Cluster ( clusterNodesArray , {
86
90
...baseOptions ,
87
91
redisOptions : {
88
92
...baseOptions ,
89
93
password : process . env . REDIS_CLUSTER_PASSWORD ,
90
94
} ,
95
+ useSRVRecords : isSRVRecord ,
91
96
clusterRetryStrategy : times => Math . min ( times * 50 , 2000 ) ,
92
97
} ) ;
93
98
}
You can’t perform that action at this time.
0 commit comments