Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: alanprot <[email protected]>
  • Loading branch information
alanprot committed Nov 22, 2024
1 parent 21cfd15 commit f54e59d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/storage/tsdb/expanded_postings_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ func newSeedByHash(size int) *seedByHash {
func (s *seedByHash) getSeed(userId string, v string) string {
h := memHashString(userId, v)
i := h % uint64(len(s.seedByHash))
l := h % uint64(len(s.strippedLock))
l := i % uint64(len(s.strippedLock))
s.strippedLock[l].RLock()
defer s.strippedLock[l].RUnlock()
return strconv.Itoa(s.seedByHash[i])
Expand All @@ -311,7 +311,7 @@ func (s *seedByHash) getSeed(userId string, v string) string {
func (s *seedByHash) incrementSeed(userId string, v string) {
h := memHashString(userId, v)
i := h % uint64(len(s.seedByHash))
l := h % uint64(len(s.strippedLock))
l := i % uint64(len(s.strippedLock))
s.strippedLock[l].Lock()
defer s.strippedLock[l].Unlock()
s.seedByHash[i]++
Expand Down

0 comments on commit f54e59d

Please sign in to comment.