Skip to content

Commit

Permalink
fix(chainsyncer): switch to ticker
Browse files Browse the repository at this point in the history
  • Loading branch information
acud committed Oct 26, 2021
1 parent 882e2b6 commit fccb61b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/chainsyncer/chainsyncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,21 +101,21 @@ func (c *ChainSyncer) manage() {
o sync.Once
positives int32
items int
timer = time.NewTimer(0)
ticker = time.NewTicker(0)
)
go func() {
<-c.quit
cancel()
_ = timer.Stop()
ticker.Stop()
}()

for {
select {
case <-c.quit:
return
case <-timer.C:
case <-ticker.C:
o.Do(func() {
timer.Reset(c.pollEvery)
ticker.Reset(c.pollEvery)
})
}
// go through every peer we are connected to
Expand Down

0 comments on commit fccb61b

Please sign in to comment.