File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed
Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -378,13 +378,13 @@ func (g *Generator) runExecuteLoop() {
378378 g .currentSegmentMu .Unlock ()
379379 // we start all vus once
380380 vus := g .stats .CurrentVUs .Load ()
381+ g .vusMu .Lock ()
381382 for i := 0 ; i < int (vus ); i ++ {
382383 inst := g .vu .Clone (g )
383384 g .runVU (inst )
384- g .vusMu .Lock ()
385385 g .vus = append (g .vus , inst )
386- g .vusMu .Unlock ()
387386 }
387+ g .vusMu .Unlock ()
388388 }
389389}
390390
@@ -512,22 +512,20 @@ func (g *Generator) processSegment() bool {
512512 if oldVUs == newVUs {
513513 return false
514514 }
515+ g .vusMu .Lock ()
515516 if oldVUs > g .currentSegment .From {
516517 for i := 0 ; i < vusToSpawn ; i ++ {
517- g .vusMu .Lock ()
518518 g .vus [i ].Stop (g )
519- g .vusMu .Unlock ()
520519 }
521520 g .vus = g .vus [vusToSpawn :]
522521 } else {
523522 for i := 0 ; i < vusToSpawn ; i ++ {
524523 inst := g .vu .Clone (g )
525524 g .runVU (inst )
526- g .vusMu .Lock ()
527525 g .vus = append (g .vus , inst )
528- g .vusMu .Unlock ()
529526 }
530527 }
528+ g .vusMu .Unlock ()
531529 }
532530 return false
533531}
@@ -632,9 +630,9 @@ func (g *Generator) pacedCall() {
632630 if ! g .Stats ().RunStarted .Load () {
633631 return
634632 }
635- // if g.rl.Load() == nil {
636- // return
637- // }
633+ if g .rl .Load () == nil {
634+ return
635+ }
638636 (* g .rl .Load ()).Take ()
639637 if g .stats .RunPaused .Load () {
640638 return
You can’t perform that action at this time.
0 commit comments