File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ export function createRedisClient(
1818 connectionName : string ,
1919 options : RedisWithClusterOptions
2020) : Redis | Cluster {
21+ let redis : Redis | Cluster ;
22+
2123 if ( options . clusterMode ) {
2224 const nodes : ClusterNode [ ] = [
2325 {
@@ -32,7 +34,7 @@ export function createRedisClient(
3234 port : options . port ,
3335 } ) ;
3436
35- return new Redis . Cluster ( nodes , {
37+ redis = new Redis . Cluster ( nodes , {
3638 ...options . clusterOptions ,
3739 redisOptions : {
3840 connectionName,
@@ -59,7 +61,7 @@ export function createRedisClient(
5961 port : options . port ,
6062 } ) ;
6163
62- return new Redis ( {
64+ redis = new Redis ( {
6365 connectionName,
6466 host : options . host ,
6567 port : options . port ,
@@ -69,4 +71,10 @@ export function createRedisClient(
6971 ...( options . tlsDisabled ? { } : { tls : { } } ) ,
7072 } ) ;
7173 }
74+
75+ redis . on ( "error" , ( error ) => {
76+ logger . error ( "Redis client error" , { connectionName, error } ) ;
77+ } ) ;
78+
79+ return redis ;
7280}
You can’t perform that action at this time.
0 commit comments