Skip to content

Commit

Permalink
Fix "concurrent map iteration and map write" while read estransport.M…
Browse files Browse the repository at this point in the history
…etrics.Responses
  • Loading branch information
mainliufeng committed Jan 11, 2022
1 parent 17a0dc1 commit 04bb67a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion estransport/metrics.go
Expand Up @@ -92,7 +92,11 @@ func (c *Client) Metrics() (Metrics, error) {
m := Metrics{
Requests: c.metrics.requests,
Failures: c.metrics.failures,
Responses: c.metrics.responses,
Responses: make(map[int]int, len(c.metrics.responses)),
}

for code, num := range c.metrics.responses {
m.Responses[code] = num
}

if pool, ok := c.pool.(connectionable); ok {
Expand Down

0 comments on commit 04bb67a

Please sign in to comment.