Skip to content

Commit

Permalink
improve locking around stats
Browse files Browse the repository at this point in the history
  • Loading branch information
darkdarkdragon committed Jan 21, 2020
1 parent 86830c5 commit 1968b94
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/testers/http_streamer.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,13 @@ func (hs *httpStreamer) stats() httpStats {

func (hs *httpStats) clone() httpStats {
r := *hs
r.errors = make(map[string]int)
for e, i := range hs.errors {
r.errors[e] = i
}
if len(hs.latencies) > 0 {
r.latencies = make([]time.Duration, len(hs.latencies))
copy(r.latencies, hs.latencies)
}
return r
}

0 comments on commit 1968b94

Please sign in to comment.