Skip to content

Commit 44860c1

Browse files
committed
naming
1 parent 26b8602 commit 44860c1

File tree

2 files changed

+18
-21
lines changed

2 files changed

+18
-21
lines changed

wasp/wasp.go

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -350,26 +350,23 @@ func NewGenerator(cfg *Config) (*Generator, error) {
350350
return g, nil
351351
}
352352

353-
// runRPSLoop initiates the generator's RPS loop, noop if load type is VU.
353+
// runGunLoop runs the generator's Gun loop
354354
// It manages request pacing for RPS after the first segment is loaded.
355-
func (g *Generator) runRPSLoop() {
356-
switch g.Cfg.LoadType {
357-
case RPS:
358-
g.ResponsesWaitGroup.Add(1)
359-
// we run pacedCall controlled by stats.CurrentRPS
360-
go func() {
361-
for {
362-
select {
363-
case <-g.ResponsesCtx.Done():
364-
g.ResponsesWaitGroup.Done()
365-
g.Log.Info().Msg("RPS generator has stopped")
366-
return
367-
default:
368-
g.pacedCall()
369-
}
355+
func (g *Generator) runGunLoop() {
356+
g.ResponsesWaitGroup.Add(1)
357+
// we run pacedCall controlled by stats.CurrentRPS
358+
go func() {
359+
for {
360+
select {
361+
case <-g.ResponsesCtx.Done():
362+
g.ResponsesWaitGroup.Done()
363+
g.Log.Info().Msg("RPS generator has stopped")
364+
return
365+
default:
366+
g.pacedCall()
370367
}
371-
}()
372-
}
368+
}
369+
}()
373370
}
374371

375372
// runSetupWithTimeout executes the VirtualUser's setup within the configured timeout.
@@ -485,9 +482,9 @@ func (g *Generator) processSegment() bool {
485482
newRateLimit := ratelimit.New(int(g.currentSegment.From), ratelimit.Per(g.Cfg.RateLimitUnitDuration), ratelimit.WithoutSlack)
486483
g.rl.Store(&newRateLimit)
487484
g.stats.CurrentRPS.Store(g.currentSegment.From)
488-
// start RPS loop once, in next segments we control it using g.rl ratelimiter
485+
// start Gun loop once, in next segments we control it using g.rl ratelimiter
489486
g.rpsLoopOnce.Do(func() {
490-
g.runRPSLoop()
487+
g.runGunLoop()
491488
})
492489
case VU:
493490
oldVUs := g.stats.CurrentVUs.Load()

wasp/wasp_bench_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func BenchmarkPacedCall(b *testing.B) {
2121
Gun: NewMockGun(&MockGunConfig{}),
2222
})
2323
require.NoError(b, err)
24-
gen.runRPSLoop()
24+
gen.runGunLoop()
2525
b.ResetTimer()
2626
for i := 0; i < b.N; i++ {
2727
gen.pacedCall()

0 commit comments

Comments
 (0)