1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-28 06:42:00 +03:00

Tweak number of retries

This commit is contained in:
Vladimir Mihailenco
2020-09-11 11:24:38 +03:00
parent 513fcfb224
commit b657760cca
8 changed files with 160 additions and 149 deletions

View File

@ -57,7 +57,7 @@ type Options struct {
DB int
// Maximum number of retries before giving up.
// Default is to not retry failed commands.
// Default is 3 retries.
MaxRetries int
// Minimum backoff between each retry.
// Default is 8 milliseconds; -1 disables backoff.
@ -164,6 +164,8 @@ func (opt *Options) init() {
if opt.MaxRetries == -1 {
opt.MaxRetries = 0
} else if opt.MaxRetries == 0 {
opt.MaxRetries = 3
}
switch opt.MinRetryBackoff {
case -1: