Skip to content

Commit

Permalink
ethdb: minor polish
Browse files Browse the repository at this point in the history
  • Loading branch information
rjl493456442 committed Jun 11, 2018
1 parent 3a91f18 commit 3266d8e
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions ethdb/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,10 @@ func (db *LDBDatabase) meter(refresh time.Duration) {
var (
errc chan error
merr error
i int = 1
)

// Iterate ad infinitum and collect the stats
for errc == nil && merr == nil {
for i := 1; errc == nil && merr == nil; i++ {
// Retrieve the database stats
stats, err := db.db.GetProperty("leveldb.stats")
if err != nil {
Expand Down Expand Up @@ -356,8 +355,7 @@ func (db *LDBDatabase) meter(refresh time.Duration) {
if db.diskWriteMeter != nil {
db.diskWriteMeter.Mark(int64((nWrite - iostats[1]) * 1024 * 1024))
}
iostats[0] = nRead
iostats[1] = nWrite
iostats[0], iostats[1] = nRead, nWrite

// Sleep a bit, then repeat the stats collection
select {
Expand All @@ -366,7 +364,6 @@ func (db *LDBDatabase) meter(refresh time.Duration) {
case <-time.After(refresh):
// Timeout, gather a new set of stats
}
i += 1
}

if errc == nil {
Expand Down

0 comments on commit 3266d8e

Please sign in to comment.