Skip to content

Commit

Permalink
p2p/discover: fix leaked goroutine in data expiration
Browse files Browse the repository at this point in the history
  • Loading branch information
ferhatelmas committed Dec 18, 2017
1 parent c6069a6 commit afa3c72
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions p2p/discover/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,14 +226,14 @@ func (db *nodeDB) ensureExpirer() {
// expirer should be started in a go routine, and is responsible for looping ad
// infinitum and dropping stale data from the database.
func (db *nodeDB) expirer() {
tick := time.Tick(nodeDBCleanupCycle)
tick := time.NewTicker(nodeDBCleanupCycle)
defer tick.Stop()
for {
select {
case <-tick:
case <-tick.C:
if err := db.expireNodes(); err != nil {
log.Error("Failed to expire nodedb items", "err", err)
}

case <-db.quit:
return
}
Expand Down

0 comments on commit afa3c72

Please sign in to comment.