Skip to content

Commit dbdcd7c

Browse files
ezekielmkhandker19
authored andcommitted
Use DialerRetries from config file in redis RingOptions. (#8864)
The redis RingOptions config knob for DialerRetries was introduced by a recent `go-redis` vendored library update (#8815). This change allows for the value of the option to be loaded from component config files.
1 parent 483d856 commit dbdcd7c

4 files changed

Lines changed: 7 additions & 0 deletions

File tree

redis/config.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ type Config struct {
6060
// PoolFIFO uses FIFO mode for each node connection pool GET/PUT (default LIFO).
6161
PoolFIFO bool
6262

63+
// Maximum number of retry attempts when dialing fails.
64+
// Default is 5 attempts.
65+
DialerRetries int `validate:"min=0"`
6366
// Maximum number of retries before giving up.
6467
// Default is to not retry failed commands.
6568
MaxRetries int `validate:"min=0"`
@@ -138,6 +141,7 @@ func NewRingFromConfig(c Config, stats prometheus.Registerer, log blog.Logger) (
138141
Password: password,
139142
TLSConfig: tlsConfig,
140143

144+
DialerRetries: c.DialerRetries,
141145
MaxRetries: c.MaxRetries,
142146
MinRetryBackoff: c.MinRetryBackoff.Duration,
143147
MaxRetryBackoff: c.MaxRetryBackoff.Duration,

test/config-next/ra.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
}
1212
],
1313
"lookupDNSAuthority": "consul.service.consul",
14+
"dialerRetries": 1,
1415
"readTimeout": "250ms",
1516
"writeTimeout": "250ms",
1617
"poolSize": 100,

test/config-next/sfe.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
}
4040
],
4141
"lookupDNSAuthority": "consul.service.consul",
42+
"dialerRetries": 1,
4243
"readTimeout": "250ms",
4344
"writeTimeout": "250ms",
4445
"poolSize": 100,

test/config-next/wfe2.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@
122122
}
123123
],
124124
"lookupDNSAuthority": "consul.service.consul",
125+
"dialerRetries": 1,
125126
"readTimeout": "250ms",
126127
"writeTimeout": "250ms",
127128
"poolSize": 100,

0 commit comments

Comments
 (0)