Skip to content

Commit

Permalink
Merge pull request #365 from redis/fix-enable-ring-gc
Browse files Browse the repository at this point in the history
fix: enable gc to eagerly recycle used elements on ring queues
  • Loading branch information
rueian authored Sep 8, 2023
2 parents 0612354 + 7326aa9 commit d5b8a10
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ring.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ func (r *ring) PutOne(m Completed) chan RedisResult {
n.c1.Wait()
}
n.one = m
n.multi = nil
n.resps = nil
n.mark = 1
s := n.slept
n.c1.L.Unlock()
Expand All @@ -75,7 +73,6 @@ func (r *ring) PutMulti(m []Completed, resps []RedisResult) chan RedisResult {
for n.mark != 0 {
n.c1.Wait()
}
n.one = Completed{}
n.multi = m
n.resps = resps
n.mark = 1
Expand Down Expand Up @@ -130,6 +127,9 @@ func (r *ring) NextResultCh() (one Completed, multi []Completed, ch chan RedisRe
if n.mark == 2 {
one, multi, ch, resps = n.one, n.multi, n.ch, n.resps
n.mark = 0
n.one = Completed{}
n.multi = nil
n.resps = nil
} else {
r.read2--
}
Expand Down

0 comments on commit d5b8a10

Please sign in to comment.