@@ -124,6 +124,8 @@ type ClusterOptions struct {
124124
125125 // UnstableResp3 enables Unstable mode for Redis Search module with RESP3.
126126 UnstableResp3 bool
127+
128+ FailingTimeLimit int // Failing time limit for a node. Default is 15 seconds.
127129}
128130
129131func (opt * ClusterOptions ) init () {
@@ -180,6 +182,10 @@ func (opt *ClusterOptions) init() {
180182 if opt .NewClient == nil {
181183 opt .NewClient = NewClient
182184 }
185+
186+ if opt .FailingTimeLimit == 0 {
187+ opt .FailingTimeLimit = 15
188+ }
183189}
184190
185191// ParseClusterURL parses a URL into ClusterOptions that can be used to connect to Redis.
@@ -284,6 +290,7 @@ func setupClusterQueryParams(u *url.URL, o *ClusterOptions) (*ClusterOptions, er
284290 o .PoolTimeout = q .duration ("pool_timeout" )
285291 o .ConnMaxLifetime = q .duration ("conn_max_lifetime" )
286292 o .ConnMaxIdleTime = q .duration ("conn_max_idle_time" )
293+ o .FailingTimeLimit = q .int ("failing_time_limit" )
287294
288295 if q .err != nil {
289296 return nil , q .err
@@ -343,6 +350,7 @@ func (opt *ClusterOptions) clientOptions() *Options {
343350 DisableIdentity : opt .DisableIdentity ,
344351 DisableIndentity : opt .DisableIdentity ,
345352 IdentitySuffix : opt .IdentitySuffix ,
353+ FailingTimeLimit : opt .FailingTimeLimit ,
346354 TLSConfig : opt .TLSConfig ,
347355 // If ClusterSlots is populated, then we probably have an artificial
348356 // cluster whose nodes are not in clustering mode (otherwise there isn't
@@ -432,7 +440,7 @@ func (n *clusterNode) MarkAsFailing() {
432440}
433441
434442func (n * clusterNode ) Failing () bool {
435- const timeout = 15 // 15 seconds
443+ timeout := int64 ( n . Client . opt . FailingTimeLimit )
436444
437445 failing := atomic .LoadUint32 (& n .failing )
438446 if failing == 0 {
0 commit comments