Unverified Commit 7870c5bf authored by Mark4z's avatar Mark4z Committed by GitHub

performance optimization: change time.After => time.NewTimer (#61)

parent 0895f959
......@@ -219,7 +219,10 @@ func (q *Queue) Poll(number int64, timeout time.Duration) ([]interface{}, error)
var timeoutC <-chan time.Time
if timeout > 0 {
timeoutC = time.After(timeout)
timer := time.NewTimer(timeout)
defer timer.Stop()
timeoutC = timer.C
}
select {
case <-sema.ready:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment