1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-29 17:41:15 +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:
GreenHedgehog
2020-09-14 15:30:50 +03:00
committed by GitHub
parent f354306eec
commit 1a65d677b3
3 changed files with 10 additions and 10 deletions

View File

@ -547,11 +547,11 @@ func (c *Ring) ForEachShard(
}
}
func (c *Ring) cmdsInfo() (map[string]*CommandInfo, error) {
func (c *Ring) cmdsInfo(ctx context.Context) (map[string]*CommandInfo, error) {
shards := c.shards.List()
var firstErr error
for _, shard := range shards {
cmdsInfo, err := shard.Client.Command(context.TODO()).Result()
cmdsInfo, err := shard.Client.Command(ctx).Result()
if err == nil {
return cmdsInfo, nil
}
@ -566,7 +566,7 @@ func (c *Ring) cmdsInfo() (map[string]*CommandInfo, error) {
}
func (c *Ring) cmdInfo(name string) *CommandInfo {
cmdsInfo, err := c.cmdsInfoCache.Get()
cmdsInfo, err := c.cmdsInfoCache.Get(c.ctx)
if err != nil {
return nil
}