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

Set cmd timeout when Block >= 0

This commit is contained in:
Vladimir Mihailenco
2018-09-13 09:14:52 +03:00
parent f7094544a5
commit 40dbb03d62
2 changed files with 11 additions and 8 deletions

View File

@ -188,7 +188,11 @@ func (c *baseClient) retryBackoff(attempt int) time.Duration {
func (c *baseClient) cmdTimeout(cmd Cmder) time.Duration {
if timeout := cmd.readTimeout(); timeout != nil {
return readTimeout(*timeout)
t := *timeout
if t == 0 {
return 0
}
return t + 10*time.Second
}
return c.opt.ReadTimeout
}