@@ -215,7 +215,7 @@ impl ClusterConnection {
215
215
if connections. is_empty ( ) {
216
216
return Err ( RedisError :: from ( (
217
217
ErrorKind :: IoError ,
218
- "It is failed to check startup nodes." ,
218
+ "It failed to check startup nodes." ,
219
219
) ) ) ;
220
220
}
221
221
Ok ( connections)
@@ -430,15 +430,28 @@ impl ClusterConnection {
430
430
let kind = err. kind ( ) ;
431
431
432
432
if kind == ErrorKind :: Ask {
433
- redirected = err. redirect_node ( ) . map ( |x| format ! ( "redis://{}" , x. 0 ) ) ;
433
+ // TODO: clean up this copy pasta
434
+ redirected = err. redirect_node ( ) . map ( |( node, _slot) | {
435
+ match self . tls {
436
+ None => format ! ( "redis://{}" , node) ,
437
+ Some ( TlsMode :: Insecure ) => format ! ( "rediss://{}/#insecure" , node) ,
438
+ Some ( TlsMode :: Secure ) => format ! ( "rediss://{}" , node) ,
439
+ }
440
+ } ) ;
434
441
is_asking = true ;
435
442
} else if kind == ErrorKind :: Moved {
436
443
// Refresh slots.
437
444
self . refresh_slots ( ) ?;
438
445
excludes. clear ( ) ;
439
446
440
447
// Request again.
441
- redirected = err. redirect_node ( ) . map ( |x| format ! ( "redis://{}" , x. 0 ) ) ;
448
+ redirected = err. redirect_node ( ) . map ( |( node, _slot) | {
449
+ match self . tls {
450
+ None => format ! ( "redis://{}" , node) ,
451
+ Some ( TlsMode :: Insecure ) => format ! ( "rediss://{}/#insecure" , node) ,
452
+ Some ( TlsMode :: Secure ) => format ! ( "rediss://{}" , node) ,
453
+ }
454
+ } ) ;
442
455
is_asking = false ;
443
456
continue ;
444
457
} else if kind == ErrorKind :: TryAgain || kind == ErrorKind :: ClusterDown {
0 commit comments