|
|
@ -248,6 +248,9 @@ func (db *Database) meter(refresh time.Duration) { |
|
|
|
merr error |
|
|
|
merr error |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
timer := time.NewTimer(refresh) |
|
|
|
|
|
|
|
defer timer.Stop() |
|
|
|
|
|
|
|
|
|
|
|
// Iterate ad infinitum and collect the stats
|
|
|
|
// Iterate ad infinitum and collect the stats
|
|
|
|
for i := 1; errc == nil && merr == nil; i++ { |
|
|
|
for i := 1; errc == nil && merr == nil; i++ { |
|
|
|
// Retrieve the database stats
|
|
|
|
// Retrieve the database stats
|
|
|
@ -399,7 +402,8 @@ func (db *Database) meter(refresh time.Duration) { |
|
|
|
select { |
|
|
|
select { |
|
|
|
case errc = <-db.quitChan: |
|
|
|
case errc = <-db.quitChan: |
|
|
|
// Quit requesting, stop hammering the database
|
|
|
|
// Quit requesting, stop hammering the database
|
|
|
|
case <-time.After(refresh): |
|
|
|
case <-timer.C: |
|
|
|
|
|
|
|
timer.Reset(refresh) |
|
|
|
// Timeout, gather a new set of stats
|
|
|
|
// Timeout, gather a new set of stats
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|