From 0e78c408068856fab1907a55892af511ab0dc0d0 Mon Sep 17 00:00:00 2001 From: greatect Date: Tue, 26 Apr 2022 13:27:01 -0700 Subject: [PATCH] fix timer queue bug --- client/timer_queue.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client/timer_queue.go b/client/timer_queue.go index 82c78743..6352827d 100644 --- a/client/timer_queue.go +++ b/client/timer_queue.go @@ -17,6 +17,7 @@ package client import ( + "container/heap" "fmt" "sync" "time" @@ -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() } @@ -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 {