Skip to content

Commit

Permalink
[CWS] close query chan when finishing the btfhub collector (#25500)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulcacheux authored May 10, 2024
1 parent 09161cd commit 3e03e40
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/security/probe/constantfetch/btfhub/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ func main() {
panic(err)
}

twCollector.close()
wg.Wait()

export := twCollector.finish()
Expand Down Expand Up @@ -239,6 +240,10 @@ func newTreeWalkCollector(preAllocHint int) *treeWalkCollector {
}
}

func (c *treeWalkCollector) close() {
close(c.queryChan)
}

func (c *treeWalkCollector) finish() constantfetch.BTFHubConstants {
slices.SortFunc(c.results, func(a extractionResult, b extractionResult) int {
return cmp.Compare(a.counter, b.counter)
Expand Down

0 comments on commit 3e03e40

Please sign in to comment.