mirror of
https://github.com/owncast/owncast.git
synced 2024-11-21 20:28:15 +03:00
Move unlock
This commit is contained in:
parent
c812a0abf5
commit
7869072c96
1 changed files with 2 additions and 1 deletions
|
@ -32,13 +32,14 @@ func GetAveragePerformance(key string) float64 {
|
||||||
}
|
}
|
||||||
|
|
||||||
l.Lock()
|
l.Lock()
|
||||||
|
defer l.Unlock()
|
||||||
|
|
||||||
delta := time.Since(timestamp).Seconds()
|
delta := time.Since(timestamp).Seconds()
|
||||||
_durationStorage[key] = append(_durationStorage[key], delta)
|
_durationStorage[key] = append(_durationStorage[key], delta)
|
||||||
if len(_durationStorage[key]) < 8 {
|
if len(_durationStorage[key]) < 8 {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
_durationStorage[key] = removeHighValue(_durationStorage[key])
|
_durationStorage[key] = removeHighValue(_durationStorage[key])
|
||||||
l.Unlock()
|
|
||||||
|
|
||||||
return avg(_durationStorage[key])
|
return avg(_durationStorage[key])
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue