aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/discv5
diff options
context:
space:
mode:
authorferhat elmas <elmas.ferhat@gmail.com>2018-01-02 19:50:46 +0800
committerFelix Lange <fjl@users.noreply.github.com>2018-01-02 19:50:46 +0800
commit5866626b0896bafb74e140bc44ddd24ff9006d91 (patch)
tree33a22af18c681e35be6c7951a12339c6da0b7f57 /p2p/discv5
parentc495bca4adef24811e92f9dfa5149b32ac81ef65 (diff)
downloadgo-tangerine-5866626b0896bafb74e140bc44ddd24ff9006d91.tar
go-tangerine-5866626b0896bafb74e140bc44ddd24ff9006d91.tar.gz
go-tangerine-5866626b0896bafb74e140bc44ddd24ff9006d91.tar.bz2
go-tangerine-5866626b0896bafb74e140bc44ddd24ff9006d91.tar.lz
go-tangerine-5866626b0896bafb74e140bc44ddd24ff9006d91.tar.xz
go-tangerine-5866626b0896bafb74e140bc44ddd24ff9006d91.tar.zst
go-tangerine-5866626b0896bafb74e140bc44ddd24ff9006d91.zip
core, p2p/discv5: use time.NewTicker instead of time.Tick (#15747)
Diffstat (limited to 'p2p/discv5')
-rw-r--r--p2p/discv5/database.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/p2p/discv5/database.go b/p2p/discv5/database.go
index a3b044ec1..3c2d5744c 100644
--- a/p2p/discv5/database.go
+++ b/p2p/discv5/database.go
@@ -239,14 +239,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(fmt.Sprintf("Failed to expire nodedb items: %v", err))
}
-
case <-db.quit:
return
}