From 7869072c96dbdd2a0efc8423c3a0f12b56ce1234 Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Mon, 4 Jan 2021 22:02:16 -0800 Subject: [PATCH] Move unlock --- utils/performanceTimer.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utils/performanceTimer.go b/utils/performanceTimer.go index a872ab27c..689d9ffb8 100644 --- a/utils/performanceTimer.go +++ b/utils/performanceTimer.go @@ -32,13 +32,14 @@ func GetAveragePerformance(key string) float64 { } l.Lock() + defer l.Unlock() + delta := time.Since(timestamp).Seconds() _durationStorage[key] = append(_durationStorage[key], delta) if len(_durationStorage[key]) < 8 { return 0 } _durationStorage[key] = removeHighValue(_durationStorage[key]) - l.Unlock() return avg(_durationStorage[key]) }