diff options
author | ferhat elmas <elmas.ferhat@gmail.com> | 2017-12-18 11:03:48 +0800 |
---|---|---|
committer | ferhat elmas <elmas.ferhat@gmail.com> | 2017-12-18 16:16:54 +0800 |
commit | afa3c72c40eee45dfbf3cbc40505b78cb2c3c6b2 (patch) | |
tree | 6ad55d90d6e308617c6af036c65f90eb3d4ceee2 | |
parent | c6069a627c42c21fc02d0770d39db9a9be45b180 (diff) | |
download | dexon-afa3c72c40eee45dfbf3cbc40505b78cb2c3c6b2.tar.gz dexon-afa3c72c40eee45dfbf3cbc40505b78cb2c3c6b2.tar.zst dexon-afa3c72c40eee45dfbf3cbc40505b78cb2c3c6b2.zip |
p2p/discover: fix leaked goroutine in data expiration
-rw-r--r-- | p2p/discover/database.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/p2p/discover/database.go b/p2p/discover/database.go index 7206a63c6..b136609f2 100644 --- a/p2p/discover/database.go +++ b/p2p/discover/database.go @@ -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 } |