Skip to content

Commit

Permalink
fix: zset remove range by rank lock by read mutex bytedance#234
Browse files Browse the repository at this point in the history
  • Loading branch information
Thoren-byte committed Dec 4, 2024
1 parent 780ca9e commit 047caee
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions collection/zset/zset.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,8 @@ func (z *Float64Set) RevRangeByScoreWithOpt(max, min float64, opt RangeOpt) []Fl
//
// RemoveRangeByRank is the replacement of ZREMRANGEBYRANK command of redis.
func (z *Float64Set) RemoveRangeByRank(start, stop int) []Float64Node {
z.mu.RLock()
defer z.mu.RUnlock()
z.mu.Lock()
defer z.mu.Unlock()

// Convert negative rank to positive.
if start < 0 {
Expand Down

0 comments on commit 047caee

Please sign in to comment.