Package list golang-github-go-kit-kit / 4fd567d
fix(generic.go): add defer to ApproximateMovingAverage mutext Currently there is a `h.mtx.RLock()` following by `h.mtx.RUnlock()`, the unlock should be a defer `defer h.mtx.RUnlock()` mishudark authored 4 years ago GitHub committed 4 years ago
1 changed file(s) with 1 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
207207 // ApproximateMovingAverage returns the approximate moving average of observations.
208208 func (h *SimpleHistogram) ApproximateMovingAverage() float64 {
209209 h.mtx.RLock()
210 h.mtx.RUnlock()
210 defer h.mtx.RUnlock()
211211 return h.avg
212212 }
213213