Skip to content

Commit

Permalink
p2p/protocols: simplify reporter.save
Browse files Browse the repository at this point in the history
  • Loading branch information
holisticode committed Nov 26, 2018
1 parent 0ba0936 commit b3d0bbf
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions p2p/protocols/reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ func (r *reporter) run() {

//send the metrics to the DB
func (r *reporter) save() error {
var err error
//create a LevelDB Batch
batch := leveldb.Batch{}
//for each metric in the registry (which is independent)...
Expand All @@ -144,13 +143,5 @@ func (r *reporter) save() error {
batch.Put([]byte(name), byteVal)
}
})
if batch.Len() > 0 {
err = r.db.Write(&batch, nil)
if err != nil {
return err
}
batch.Reset()
}

return err
return r.db.Write(&batch, nil)
}

0 comments on commit b3d0bbf

Please sign in to comment.