Skip to content

Commit

Permalink
Fix metrics data race in the Engine test run finalization
Browse files Browse the repository at this point in the history
This should close #1887
  • Loading branch information
na-- authored and imiric committed Mar 8, 2021
1 parent f1413e6 commit 2036bae
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions core/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,15 @@ func (e *Engine) processMetrics(globalCtx context.Context, processMetricsAfterRu
case <-ticker.C:
processSamples()
case <-processMetricsAfterRun:
getCachedMetrics:
for {
select {
case sc := <-e.Samples:
sampleContainers = append(sampleContainers, sc)
default:
break getCachedMetrics
}
}
e.logger.Debug("Processing metrics and thresholds after the test run has ended...")
processSamples()
if !e.runtimeOptions.NoThresholds.Bool {
Expand Down

0 comments on commit 2036bae

Please sign in to comment.