mirror of
https://github.com/hibiken/asynq.git
synced 2024-12-25 23:32:17 +08:00
Change (*poller).start to use time.Sleep instead of ticker
This commit is contained in:
parent
89c54fb47d
commit
8d22d1f6fb
@ -27,14 +27,14 @@ func (p *poller) terminate() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *poller) start() {
|
func (p *poller) start() {
|
||||||
ticker := time.NewTicker(p.avgInterval)
|
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-ticker.C:
|
|
||||||
p.enqueue()
|
|
||||||
case <-p.done:
|
case <-p.done:
|
||||||
p.shutdown()
|
p.shutdown()
|
||||||
|
default:
|
||||||
|
p.enqueue()
|
||||||
|
time.Sleep(p.avgInterval)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
Loading…
Reference in New Issue
Block a user