mirror of
https://github.com/redis/go-redis.git
synced 2025-06-14 01:21:30 +03:00
Fix not applying updated ClusterClient context after calling WithContext method (#1480)
pass context to command info cache init call
This commit is contained in:
@ -1554,7 +1554,7 @@ func (c *ClusterClient) retryBackoff(attempt int) time.Duration {
|
||||
return internal.RetryBackoff(attempt, c.opt.MinRetryBackoff, c.opt.MaxRetryBackoff)
|
||||
}
|
||||
|
||||
func (c *ClusterClient) cmdsInfo() (map[string]*CommandInfo, error) {
|
||||
func (c *ClusterClient) cmdsInfo(ctx context.Context) (map[string]*CommandInfo, error) {
|
||||
// Try 3 random nodes.
|
||||
const nodeLimit = 3
|
||||
|
||||
@ -1581,7 +1581,7 @@ func (c *ClusterClient) cmdsInfo() (map[string]*CommandInfo, error) {
|
||||
continue
|
||||
}
|
||||
|
||||
info, err := node.Client.Command(c.ctx).Result()
|
||||
info, err := node.Client.Command(ctx).Result()
|
||||
if err == nil {
|
||||
return info, nil
|
||||
}
|
||||
@ -1597,7 +1597,7 @@ func (c *ClusterClient) cmdsInfo() (map[string]*CommandInfo, error) {
|
||||
}
|
||||
|
||||
func (c *ClusterClient) cmdInfo(name string) *CommandInfo {
|
||||
cmdsInfo, err := c.cmdsInfoCache.Get()
|
||||
cmdsInfo, err := c.cmdsInfoCache.Get(c.ctx)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user