mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 02:42:27 +00:00
p2p/protocols: fix possible metric loss in AccountingMetrics
This commit is contained in:
parent
616cf78203
commit
b0b3b0fcb3
1 changed files with 4 additions and 0 deletions
|
|
@ -36,6 +36,10 @@ type AccountingMetrics struct {
|
||||||
//for a graceful cleanup
|
//for a graceful cleanup
|
||||||
func (am *AccountingMetrics) Close() {
|
func (am *AccountingMetrics) Close() {
|
||||||
close(am.reporter.quit)
|
close(am.reporter.quit)
|
||||||
|
// save account metrics on close to avoid data loss
|
||||||
|
// when more metrics are measured between the last
|
||||||
|
// reporter run ticker tick and the close
|
||||||
|
am.reporter.save()
|
||||||
am.reporter.db.Close()
|
am.reporter.db.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue