Skip to content

Commit

Permalink
fix timer queue bug
Browse files Browse the repository at this point in the history
  • Loading branch information
greatect committed Apr 26, 2022
1 parent 934e21f commit 0e78c40
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions client/timer_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package client

import (
"container/heap"
"fmt"
"sync"
"time"
Expand Down Expand Up @@ -72,7 +73,7 @@ func (a *TimerQueue) Remove(i Item) error {
defer a.Unlock()
if mo := a.priq.Peek(); mo != nil {
if mo.Value.(Item).Priority() == i.Priority() {
_ = a.priq.Pop()
_ = heap.Pop(a.priq)
if a.priq.Len() > 0 {
a.Signal()
}
Expand Down Expand Up @@ -114,7 +115,7 @@ func (a *TimerQueue) wakeupCh() chan struct{} {
// pop top item from queue and forward to next queue
func (a *TimerQueue) forward() {
a.Lock()
m := a.priq.Pop()
m := heap.Pop(a.priq)

a.Unlock()
if m == nil {
Expand Down

0 comments on commit 0e78c40

Please sign in to comment.