File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed
Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -31,12 +31,14 @@ async function subscriberRoutine(
3131 }
3232 totalSubscribedRef . value -= channels . slice ( 1 ) . length ;
3333 }
34- // Duplicate connection afresh.
35- pubsub = client . duplicate ( ) ;
36- } else {
37- pubsub = client . duplicate ( ) ;
34+ // Close existing connection before creating new one
35+ await pubsub . quit ( ) ;
3836 }
3937
38+ // Duplicate connection afresh.
39+ // For cluster clients, duplicate() creates a new cluster-aware client
40+ pubsub = client . duplicate ( ) ;
41+
4042 // Set up error logging.
4143 pubsub . on ( 'error' , ( err ) => {
4244 console . error ( `[${ clientName } ] Redis error: ${ err . message } ` ) ;
Original file line number Diff line number Diff line change 66 "dependencies" : {
77 "cluster-key-slot" : " ^1.1.0" ,
88 "hdr-histogram-js" : " ^2.0.1" ,
9- "ioredis" : " ^4.30 .0" ,
9+ "ioredis" : " ^5.6 .0" ,
1010 "seedrandom" : " ^3.0.5" ,
1111 "yargs" : " ^17.7.2"
1212 },
You can’t perform that action at this time.
0 commit comments