File tree 1 file changed +10
-2
lines changed
1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ export function createRedisClient(
18
18
connectionName : string ,
19
19
options : RedisWithClusterOptions
20
20
) : Redis | Cluster {
21
+ let redis : Redis | Cluster ;
22
+
21
23
if ( options . clusterMode ) {
22
24
const nodes : ClusterNode [ ] = [
23
25
{
@@ -32,7 +34,7 @@ export function createRedisClient(
32
34
port : options . port ,
33
35
} ) ;
34
36
35
- return new Redis . Cluster ( nodes , {
37
+ redis = new Redis . Cluster ( nodes , {
36
38
...options . clusterOptions ,
37
39
redisOptions : {
38
40
connectionName,
@@ -59,7 +61,7 @@ export function createRedisClient(
59
61
port : options . port ,
60
62
} ) ;
61
63
62
- return new Redis ( {
64
+ redis = new Redis ( {
63
65
connectionName,
64
66
host : options . host ,
65
67
port : options . port ,
@@ -69,4 +71,10 @@ export function createRedisClient(
69
71
...( options . tlsDisabled ? { } : { tls : { } } ) ,
70
72
} ) ;
71
73
}
74
+
75
+ redis . on ( "error" , ( error ) => {
76
+ logger . error ( "Redis client error" , { connectionName, error } ) ;
77
+ } ) ;
78
+
79
+ return redis ;
72
80
}
You can’t perform that action at this time.
0 commit comments