Merge pull request #15696 from ferhatelmas/p2p-goroutine-leak

p2p/discover: fix leaked goroutine in data expiration
This commit is contained in:
Péter Szilágyi 2017-12-18 10:59:10 +02:00 committed by GitHub
commit 13db4af345
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
}