feat(go): add load simulator hold mode
This commit is contained in:
@@ -37,6 +37,9 @@ func (r Runner) Run(ctx context.Context, cfg Config) (Stats, error) {
|
||||
if err != nil {
|
||||
return Stats{}, err
|
||||
}
|
||||
if !cfg.SendFrames {
|
||||
payload = nil
|
||||
}
|
||||
dial := r.Dial
|
||||
if dial == nil {
|
||||
dialer := &net.Dialer{Timeout: 5 * time.Second, KeepAlive: 30 * time.Second}
|
||||
@@ -68,7 +71,11 @@ func (r Runner) Run(ctx context.Context, cfg Config) (Stats, error) {
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
defer conn.Close()
|
||||
writeLoop(runCtx, conn, payload, cfg.SendInterval, &stats)
|
||||
if cfg.SendFrames {
|
||||
writeLoop(runCtx, conn, payload, cfg.SendInterval, &stats)
|
||||
return
|
||||
}
|
||||
<-runCtx.Done()
|
||||
}()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user