Skip to content

Commit 803480d

Browse files
committed
fix channel deadlock
Signed-off-by: Markus Blaschke <mblaschke82@gmail.com>
1 parent 5ec4d80 commit 803480d

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

loganalytics/prober.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -228,25 +228,25 @@ func (p *LogAnalyticsProber) executeQueries() {
228228
wgProbes := p.NewSizedWaitGroup()
229229

230230
// query workspaces
231-
for _, row := range p.workspaceList {
232-
workspaceId := row
233-
// Run the query and get the results
234-
prometheusQueryRequests.With(prometheus.Labels{"workspaceID": workspaceId, "module": p.config.moduleName, "metric": queryConfig.Metric}).Inc()
235-
236-
wgProbes.Add()
237-
go func() {
238-
defer wgProbes.Done()
239-
p.sendQueryToWorkspace(
240-
contextLogger,
241-
workspaceId,
242-
queryClient,
243-
queryConfig,
244-
resultChannel,
245-
)
246-
}()
247-
}
248-
249231
go func() {
232+
for _, row := range p.workspaceList {
233+
workspaceId := row
234+
// Run the query and get the results
235+
prometheusQueryRequests.With(prometheus.Labels{"workspaceID": workspaceId, "module": p.config.moduleName, "metric": queryConfig.Metric}).Inc()
236+
237+
wgProbes.Add()
238+
go func() {
239+
defer wgProbes.Done()
240+
p.sendQueryToWorkspace(
241+
contextLogger,
242+
workspaceId,
243+
queryClient,
244+
queryConfig,
245+
resultChannel,
246+
)
247+
}()
248+
}
249+
250250
// wait until queries are done for closing channel and waiting for result process
251251
wgProbes.Wait()
252252
close(resultChannel)

0 commit comments

Comments
 (0)