|
|
@ -239,14 +239,14 @@ func (db *nodeDB) ensureExpirer() { |
|
|
|
// expirer should be started in a go routine, and is responsible for looping ad
|
|
|
|
// expirer should be started in a go routine, and is responsible for looping ad
|
|
|
|
// infinitum and dropping stale data from the database.
|
|
|
|
// infinitum and dropping stale data from the database.
|
|
|
|
func (db *nodeDB) expirer() { |
|
|
|
func (db *nodeDB) expirer() { |
|
|
|
tick := time.Tick(nodeDBCleanupCycle) |
|
|
|
tick := time.NewTicker(nodeDBCleanupCycle) |
|
|
|
|
|
|
|
defer tick.Stop() |
|
|
|
for { |
|
|
|
for { |
|
|
|
select { |
|
|
|
select { |
|
|
|
case <-tick: |
|
|
|
case <-tick.C: |
|
|
|
if err := db.expireNodes(); err != nil { |
|
|
|
if err := db.expireNodes(); err != nil { |
|
|
|
log.Error(fmt.Sprintf("Failed to expire nodedb items: %v", err)) |
|
|
|
log.Error(fmt.Sprintf("Failed to expire nodedb items: %v", err)) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
case <-db.quit: |
|
|
|
case <-db.quit: |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|