File tree Expand file tree Collapse file tree 3 files changed +8
-2
lines changed Expand file tree Collapse file tree 3 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ export default class ConnectionPool extends EventEmitter {
40
40
* Find or create a connection to the node
41
41
*/
42
42
findOrCreate ( node : RedisOptions , readOnly = false ) : Redis {
43
- const key = getNodeKey ( node ) ;
43
+ const key = this . getNodeKey ( node ) ;
44
44
readOnly = Boolean ( readOnly ) ;
45
45
46
46
if ( this . specifiedOptions [ key ] ) {
@@ -113,7 +113,7 @@ export default class ConnectionPool extends EventEmitter {
113
113
debug ( "Reset with %O" , nodes ) ;
114
114
const newNodes = { } ;
115
115
nodes . forEach ( ( node ) => {
116
- const key = getNodeKey ( node ) ;
116
+ const key = this . getNodeKey ( node ) ;
117
117
118
118
// Don't override the existing (master) node
119
119
// when the current one is slave.
@@ -147,4 +147,8 @@ export default class ConnectionPool extends EventEmitter {
147
147
delete nodes . master [ key ] ;
148
148
delete nodes . slave [ key ] ;
149
149
}
150
+
151
+ private getNodeKey ( options : RedisOptions ) {
152
+ return getNodeKey ( options ) + ':' + options . nodeId ;
153
+ }
150
154
}
Original file line number Diff line number Diff line change @@ -864,6 +864,7 @@ class Cluster extends Commander {
864
864
port : items [ j ] [ 1 ] ,
865
865
} ) ;
866
866
node . readOnly = j !== 2 ;
867
+ node . nodeId = items [ j ] [ 2 ] ;
867
868
nodes . push ( node ) ;
868
869
keys . push ( node . host + ":" + node . port ) ;
869
870
}
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ export interface RedisOptions {
10
10
host : string ;
11
11
username ?: string ;
12
12
password ?: string ;
13
+ nodeId ?: string ;
13
14
[ key : string ] : any ;
14
15
}
15
16
You can’t perform that action at this time.
0 commit comments