Skip to content

Commit

Permalink
[usm] reliability, preparation for pool of objects, RequestStats.Comb…
Browse files Browse the repository at this point in the history
…ineWith(), each newRequests.CanRelease=true
  • Loading branch information
yuri-lipnesh committed Dec 20, 2024
1 parent 13b849a commit 196aaf9
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions pkg/network/protocols/http/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,16 +160,15 @@ func (r *RequestStats) isValid(status uint16) bool {
// newStats is kept as it is, while the method receiver gets mutated
func (r *RequestStats) CombineWith(newStats *RequestStats) {
for statusCode, newRequests := range newStats.Data {
newRequests.CanRelease = true
if newRequests.Count == 0 {
// Nothing to do in this case
newRequests.CanRelease = true
continue
}

if newRequests.Count == 1 {
// The other bucket has a single latency sample, so we "manually" add it
r.AddRequest(statusCode, newRequests.FirstLatencySample, newRequests.StaticTags, newRequests.DynamicTags)
newRequests.CanRelease = true
continue
}

Expand All @@ -196,7 +195,6 @@ func (r *RequestStats) CombineWith(newStats *RequestStats) {
if err != nil {
log.Debugf("error merging http transactions: %v", err)
}
newRequests.CanRelease = true
}
stats.Count += newRequests.Count
}
Expand Down

0 comments on commit 196aaf9

Please sign in to comment.