Skip to content

Commit 504c3f6

Browse files
committed
Refactor implementation and add unit tests
Signed-off-by: Wilbert Guo <[email protected]>
1 parent fffc775 commit 504c3f6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/ruler/ruler.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,8 +1343,8 @@ func (r *Ruler) getShardSizeForUser(userID string) int {
13431343
func (r *Ruler) getShardedRules(ctx context.Context, userID string, rulesRequest RulesRequest) (*RulesResponse, error) {
13441344
ring := ring.ReadRing(r.ring)
13451345

1346-
if shardSize := r.limits.RulerTenantShardSize(userID); shardSize > 0 && r.cfg.ShardingStrategy == util.ShardingStrategyShuffle {
1347-
shardSize := util.DynamicShardSize(shardSize, r.ring.InstancesCount())
1346+
if r.cfg.ShardingStrategy == util.ShardingStrategyShuffle {
1347+
shardSize := r.getShardSizeForUser(userID)
13481348
ring = r.ring.ShuffleShard(userID, shardSize)
13491349
}
13501350

0 commit comments

Comments
 (0)