Skip to content

Commit

Permalink
Fixed redis cache to use multi batch size
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Ryabov <abbyssoul@gmail.com>
  • Loading branch information
abbyssoul committed Nov 12, 2022
1 parent b2badad commit 0ab2746
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re
## Unreleased

### Fixed
- []() Cache: fixed redis client not respecting `SetMultiBatchSize` config value.

- [#5844](https://github.com/thanos-io/thanos/pull/5844) Query Frontend: Fixes @ modifier time range when splitting queries by interval.
- [#5854](https://github.com/thanos-io/thanos/pull/5854) Query Frontend: Handles `lookback_delta` param in query frontend.
Expand Down
3 changes: 2 additions & 1 deletion pkg/cacheutil/redis_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,9 @@ func (c *RedisClient) SetMulti(ctx context.Context, data map[string][]byte, ttl
keys = append(keys, k)
}
err := doWithBatch(ctx, len(data), c.config.SetMultiBatchSize, c.setMultiGate, func(startIndex, endIndex int) error {
currentKeys := keys[startIndex:endIndex]
_, err := c.Pipelined(ctx, func(p redis.Pipeliner) error {
for _, key := range keys {
for _, key := range currentKeys {
p.SetEX(ctx, key, data[key], ttl)
}
return nil
Expand Down

0 comments on commit 0ab2746

Please sign in to comment.