Skip to content

Commit

Permalink
redis.Client#XReadUntilResult(): also re-try timeout errors
Browse files Browse the repository at this point in the history
An XREAD with BLOCK sets a socket timeout of BLOCK+10s.
If reading the response hits that timeout, it's not re-tried due to BLOCK.
Hence, we have to re-ty it by ourselves.
  • Loading branch information
Al2Klimov committed Aug 7, 2024
1 parent 420fbff commit 33a5b7b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions redis/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,13 @@ func (c *Client) XReadUntilResult(ctx context.Context, a *redis.XReadArgs) ([]re
continue
}

var timeout interface {
Timeout() bool
}
if errors.As(err, &timeout) && timeout.Timeout() && !errors.Is(err, context.DeadlineExceeded) {
continue
}

return streams, WrapCmdErr(cmd)
}

Expand Down

0 comments on commit 33a5b7b

Please sign in to comment.