Skip to content

Commit ba198ab

Browse files
committed
Simplified unlock
Signed-off-by: Marco Pracucci <[email protected]>
1 parent 42f0afd commit ba198ab

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

pkg/ring/ring.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,7 @@ func (r *Ring) ShuffleShard(identifier string, size int) ReadRing {
500500
random := rand.New(rand.NewSource(seed))
501501

502502
r.mtx.RLock()
503+
defer r.mtx.RUnlock()
503504

504505
// We expect the shard size to be divisible by the number of zones, in order to
505506
// have nodes balanced across zones. If it's not, we do round up.
@@ -544,8 +545,6 @@ func (r *Ring) ShuffleShard(identifier string, size int) ReadRing {
544545
}
545546
}
546547

547-
r.mtx.RUnlock()
548-
549548
// Build a read-only ring for the shard.
550549
shardDesc := &Desc{Ingesters: shard}
551550
shardTokensByZone := shardDesc.getTokensByZone()

0 commit comments

Comments
 (0)