Skip to content

Commit 2de1666

Browse files
authored
APIGOV-SDB01 - fix deatlock found in unit test (#1033)
1 parent 9d86626 commit 2de1666

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

pkg/traceability/sampling/sample.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,14 @@ func (s *sample) sampleEndpointAndOnlyErrors(apiID string) (bool, bool) {
138138
return true, s.endpointsSampling.endpointsInfo[apiID] // endpoint found, return onlyErrors
139139
}
140140

141-
func (s *sample) resetEndpointSampling() {
141+
func (s *sample) hasRemainingEndpoints() bool {
142142
s.endpointsSampling.endpointsLock.Lock()
143143
defer s.endpointsSampling.endpointsLock.Unlock()
144-
if len(s.endpointsSampling.endpointsInfo) > 0 {
144+
return len(s.endpointsSampling.endpointsInfo) > 0
145+
}
146+
147+
func (s *sample) resetEndpointSampling() {
148+
if s.hasRemainingEndpoints() {
145149
return
146150
}
147151
s.endpointsSampling.enabled.Store(false)

0 commit comments

Comments
 (0)