Avoid `defer` in seriesMap.get
This is related to https://github.com/golang/go/issues/14939 . It's probably the only occurrence where it matters.
This commit is contained in:
parent
2ee00b4461
commit
ca98382943
|
@ -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