discov: add status log for bootnode (#1878)
This commit is contained in:
parent
1bc27f6d98
commit
2c7a07bc57
1
go.mod
1
go.mod
@ -245,7 +245,6 @@ require (
|
||||
github.com/schollz/progressbar/v3 v3.3.4 // indirect
|
||||
github.com/sirupsen/logrus v1.9.0 // indirect
|
||||
github.com/spaolacci/murmur3 v1.1.0 // indirect
|
||||
github.com/supranational/blst v0.3.11 // indirect
|
||||
github.com/thomaso-mirodin/intmath v0.0.0-20160323211736-5dc6d854e46e // indirect
|
||||
github.com/tidwall/gjson v1.10.2 // indirect
|
||||
github.com/tidwall/match v1.1.1 // indirect
|
||||
|
@ -411,6 +411,7 @@ func (t *UDPv4) loop() {
|
||||
var (
|
||||
plist = list.New()
|
||||
timeout = time.NewTimer(0)
|
||||
statusTicker = time.NewTicker(60 * time.Second)
|
||||
nextTimeout *replyMatcher // head of plist when timeout was last reset
|
||||
contTimeouts = 0 // number of continuous timeouts to do NTP checks
|
||||
ntpWarnTime = time.Unix(0, 0)
|
||||
@ -440,6 +441,10 @@ func (t *UDPv4) loop() {
|
||||
timeout.Stop()
|
||||
}
|
||||
|
||||
logStatistic := func() {
|
||||
t.log.Info("Current status", "table_size", t.tab.len(), "pending_size", plist.Len(), "db_size", t.db.Size())
|
||||
}
|
||||
|
||||
for {
|
||||
resetTimeout()
|
||||
|
||||
@ -495,6 +500,9 @@ func (t *UDPv4) loop() {
|
||||
}
|
||||
contTimeouts = 0
|
||||
}
|
||||
|
||||
case <-statusTicker.C:
|
||||
logStatistic()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -504,3 +504,9 @@ func (db *DB) Close() {
|
||||
close(db.quit)
|
||||
db.lvl.Close()
|
||||
}
|
||||
|
||||
func (db *DB) Size() int64 {
|
||||
var stats leveldb.DBStats
|
||||
db.lvl.Stats(&stats)
|
||||
return stats.LevelSizes.Sum()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user