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 grafana/k6#1887
  • Loading branch information
na-- authored and imiric committed Mar 8, 2021
1 parent d1c7a08 commit e73a013
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 ***REMOVED***
select ***REMOVED***
case sc := <-e.Samples:
sampleContainers = append(sampleContainers, sc)
default:
break getCachedMetrics
***REMOVED***
***REMOVED***
e.logger.Debug("Processing metrics and thresholds after the test run has ended...")
processSamples()
if !e.runtimeOptions.NoThresholds.Bool ***REMOVED***
Expand Down

0 comments on commit e73a013

Please sign in to comment.