Skip to content

Commit

Permalink
fix potential goroutine leak (#4291) (#4294)
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-srebot authored Dec 8, 2021
1 parent 9228811 commit b3acd74
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/tikvapi/tikvapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,12 @@ func (c *tikvClient) GetLeaderCount() (int, error) {
}
}()

for mf := range mfChan {
fm := prom2json.NewFamily(mf)
fms := []*prom2json.Family{}
for mfc := range mfChan {
fm := prom2json.NewFamily(mfc)
fms = append(fms, fm)
}
for _, fm := range fms {
if fm.Name == metricNameRegionCount {
for _, m := range fm.Metrics {
if m, ok := m.(prom2json.Metric); ok && m.Labels["type"] == labelNameLeaderCount {
Expand Down

0 comments on commit b3acd74

Please sign in to comment.