Skip to content

Commit 23551b9

Browse files
committed
move mutex
1 parent 1fb6499 commit 23551b9

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

wasp/wasp.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -513,20 +513,20 @@ func (g *Generator) processSegment() bool {
513513
return false
514514
}
515515
if oldVUs > g.currentSegment.From {
516+
g.vusMu.Lock()
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:]
521+
g.vusMu.Unlock()
522522
} else {
523+
g.vusMu.Lock()
523524
for i := 0; i < vusToSpawn; i++ {
524525
inst := g.vu.Clone(g)
525526
g.runVU(inst)
526-
g.vusMu.Lock()
527527
g.vus = append(g.vus, inst)
528-
g.vusMu.Unlock()
529528
}
529+
g.vusMu.Unlock()
530530
}
531531
}
532532
return false
@@ -632,9 +632,9 @@ func (g *Generator) pacedCall() {
632632
if !g.Stats().RunStarted.Load() {
633633
return
634634
}
635-
//if g.rl.Load() == nil {
636-
// return
637-
//}
635+
if g.rl.Load() == nil {
636+
return
637+
}
638638
(*g.rl.Load()).Take()
639639
if g.stats.RunPaused.Load() {
640640
return

0 commit comments

Comments
 (0)