2
0
mirror of https://github.com/hibiken/asynq.git synced 2024-11-10 11:31:58 +08:00

Change (*poller).start to use time.Sleep instead of ticker

This commit is contained in:
Ken Hibino 2019-11-19 06:20:59 -08:00
parent 89c54fb47d
commit 8d22d1f6fb

View File

@ -27,14 +27,14 @@ func (p *poller) terminate() {
}
func (p *poller) start() {
ticker := time.NewTicker(p.avgInterval)
go func() {
for {
select {
case <-ticker.C:
p.enqueue()
case <-p.done:
p.shutdown()
default:
p.enqueue()
time.Sleep(p.avgInterval)
}
}
}()