mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
p2p/protocols: simplify reporter.save
This commit is contained in:
parent
0ba0936b63
commit
b3d0bbf760
1 changed files with 1 additions and 10 deletions
|
|
@ -128,7 +128,6 @@ func (r *reporter) run() {
|
||||||
|
|
||||||
//send the metrics to the DB
|
//send the metrics to the DB
|
||||||
func (r *reporter) save() error {
|
func (r *reporter) save() error {
|
||||||
var err error
|
|
||||||
//create a LevelDB Batch
|
//create a LevelDB Batch
|
||||||
batch := leveldb.Batch{}
|
batch := leveldb.Batch{}
|
||||||
//for each metric in the registry (which is independent)...
|
//for each metric in the registry (which is independent)...
|
||||||
|
|
@ -144,13 +143,5 @@ func (r *reporter) save() error {
|
||||||
batch.Put([]byte(name), byteVal)
|
batch.Put([]byte(name), byteVal)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if batch.Len() > 0 {
|
return r.db.Write(&batch, nil)
|
||||||
err = r.db.Write(&batch, nil)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
batch.Reset()
|
|
||||||
}
|
|
||||||
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue