File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -259,12 +259,16 @@ var (
259259// NewUniversalClient returns a new multi client. The type of the returned client depends
260260// on the following conditions:
261261//
262- // 1. If the MasterName option is specified, a sentinel-backed FailoverClient is returned.
263- // 2. if the number of Addrs is two or more, a ClusterClient is returned.
262+ // 1. If the MasterName option is specified with RouteByLatency, RouteRandomly or IsClusterMode,
263+ // a FailoverClusterClient is returned.
264+ // 2. If the MasterName option is specified without RouteByLatency, RouteRandomly or IsClusterMode,
265+ // a sentinel-backed FailoverClient is returned.
266+ // 2. If the number of Addrs is two or more, or IsClusterMode option is specified,
267+ // a ClusterClient is returned.
264268// 3. Otherwise, a single-node Client is returned.
265269func NewUniversalClient (opts * UniversalOptions ) UniversalClient {
266270 switch {
267- case opts .MasterName != "" && (opts .RouteByLatency || opts .RouteRandomly ):
271+ case opts .MasterName != "" && (opts .RouteByLatency || opts .RouteRandomly || opts . IsClusterMode ):
268272 return NewFailoverClusterClient (opts .Failover ())
269273 case opts .MasterName != "" :
270274 return NewFailoverClient (opts .Failover ())
You can’t perform that action at this time.
0 commit comments