From 01e5cd73ee698eae5490433c1e9eacc8e35ea502 Mon Sep 17 00:00:00 2001 From: Simon J Mudd Date: Mon, 17 Nov 2014 09:23:49 +0100 Subject: [PATCH] Collect only the data as we need it --- state/state.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/state/state.go b/state/state.go index 4df68d2..7b48221 100644 --- a/state/state.go +++ b/state/state.go @@ -75,11 +75,7 @@ func (state *State) Setup(dbh *sql.DB) { // do a fresh collection of data and then update the initial values based on that. func (state *State) ResetDBStatistics() { - // collect all initial values on startup / reset - state.fsbi.Collect(state.dbh) - state.tlwsbt.Collect(state.dbh) - state.tiwsbt.Collect(state.dbh) - + state.CollectAll() state.UpdateInitialValues() } @@ -91,6 +87,13 @@ func (state *State) UpdateInitialValues() { lib.Logger.Println("state.UpdateInitialValues() took", time.Duration(time.Since(start)).String()) } +// collect all initial values on startup / reset +func (state *State) CollectAll() { + state.fsbi.Collect(state.dbh) + state.tlwsbt.Collect(state.dbh) + state.tiwsbt.Collect(state.dbh) +} + // Only collect the data we are looking at. func (state *State) Collect() { start := time.Now() -- 2.7.4