mirror of
https://github.com/redis/go-redis.git
synced 2025-07-28 06:42:00 +03:00
Cancel sleep when context is cancelled
This commit is contained in:
8
ring.go
8
ring.go
@ -553,7 +553,9 @@ func (c *Ring) cmdShard(cmd Cmder) (*ringShard, error) {
|
||||
func (c *Ring) process(ctx context.Context, cmd Cmder) error {
|
||||
for attempt := 0; attempt <= c.opt.MaxRetries; attempt++ {
|
||||
if attempt > 0 {
|
||||
time.Sleep(c.retryBackoff(attempt))
|
||||
if err := internal.Sleep(ctx, c.retryBackoff(attempt)); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
shard, err := c.cmdShard(cmd)
|
||||
@ -626,7 +628,9 @@ func (c *Ring) generalProcessPipeline(
|
||||
|
||||
for attempt := 0; attempt <= c.opt.MaxRetries; attempt++ {
|
||||
if attempt > 0 {
|
||||
time.Sleep(c.retryBackoff(attempt))
|
||||
if err := internal.Sleep(ctx, c.retryBackoff(attempt)); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
var mu sync.Mutex
|
||||
|
Reference in New Issue
Block a user