Browse Source

pkg/metrics: protect global vars in reset func

Yicheng Qin 11 years ago
parent
commit
8c932ff719
1 changed files with 2 additions and 0 deletions
  1. 2 0
      pkg/metrics/metrics.go

+ 2 - 0
pkg/metrics/metrics.go

@@ -158,6 +158,8 @@ func Do(f func(expvar.KeyValue)) {
 
 // for test only
 func reset() {
+	mutex.Lock()
+	defer mutex.Unlock()
 	vars = make(map[string]expvar.Var)
 	varKeys = nil
 }