Fix panic when no timers are left after dispatch
This commit is contained in:
parent
d76e0850ae
commit
22d69d24d0
@ -325,9 +325,12 @@ func (self *Loop) run() (err error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
timeout := self.timers[0].deadline.Sub(now)
|
var timeout time.Duration
|
||||||
if timeout < 0 {
|
if len(self.timers) > 0 {
|
||||||
timeout = 0
|
timeout = self.timers[0].deadline.Sub(now)
|
||||||
|
if timeout < 0 {
|
||||||
|
timeout = 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
timeout_chan = time.After(timeout)
|
timeout_chan = time.After(timeout)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user