@@ -46,7 +46,7 @@ ConnectionPool.prototype.findOrCreate = function (node, readOnly) {
46
46
redis = this . nodes . all [ node . key ] ;
47
47
if ( redis . options . readOnly !== readOnly ) {
48
48
redis . options . readOnly = readOnly ;
49
- debug ( 'Change role of %s to %s' , node . key , readOnly ? 'slave' : 'master' )
49
+ debug ( 'Change role of %s to %s' , node . key , readOnly ? 'slave' : 'master' ) ;
50
50
redis [ readOnly ? 'readonly' : 'readwrite' ] ( ) . catch ( _ . noop ) ;
51
51
if ( readOnly ) {
52
52
delete this . nodes . master [ node . key ] ;
@@ -59,7 +59,14 @@ ConnectionPool.prototype.findOrCreate = function (node, readOnly) {
59
59
} else {
60
60
debug ( 'Connecting to %s as %s' , node . key , readOnly ? 'slave' : 'master' ) ;
61
61
redis = new Redis ( _ . defaults ( {
62
+ // Never try to reconnect when a node is lose,
63
+ // instead, waiting for a `MOVED` error and
64
+ // fetch the slots again.
62
65
retryStrategy : null ,
66
+ // Offline queue should be enabled so that
67
+ // we don't need to wait for the `ready` event
68
+ // before sending commands to the node.
69
+ enableOfflineQueue : true ,
63
70
readOnly : readOnly
64
71
} , node , this . redisOptions , { lazyConnect : true } ) ) ;
65
72
this . nodes . all [ node . key ] = redis ;
0 commit comments