mirror of
https://github.com/prometheus/prometheus
synced 2025-01-16 11:53:16 +00:00
Merge pull request #2021 from prometheus/beorn7/storage
Avoid `defer` in seriesMap.get
This commit is contained in:
commit
71b332278d
@ -66,9 +66,11 @@ func (sm *seriesMap) length() int {
|
||||
// semantics as the native Go map.
|
||||
func (sm *seriesMap) get(fp model.Fingerprint) (s *memorySeries, ok bool) {
|
||||
sm.mtx.RLock()
|
||||
defer sm.mtx.RUnlock()
|
||||
|
||||
s, ok = sm.m[fp]
|
||||
// Note that the RUnlock is not done via defer for performance reasons.
|
||||
// TODO(beorn7): Once https://github.com/golang/go/issues/14939 is
|
||||
// fixed, revert to the usual defer idiom.
|
||||
sm.mtx.RUnlock()
|
||||
return
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user