diff options
| author | Shulhan <ms@kilabit.info> | 2021-04-09 20:26:42 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2021-04-09 20:26:42 +0700 |
| commit | 97c73e8d703fd3782ac67969d60b02d380cda552 (patch) | |
| tree | 78789417f57aac5d1ff91e74767ffb5ea80e84dd | |
| parent | 54b335663fd245c37d04800e3b7e7250b9e913fe (diff) | |
| download | gorankusu-97c73e8d703fd3782ac67969d60b02d380cda552.tar.xz | |
all: reformat "if ... && ..." on RunRequest
| -rw-r--r-- | run_request.go | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/run_request.go b/run_request.go index eccb202..fa8cb88 100644 --- a/run_request.go +++ b/run_request.go @@ -29,13 +29,11 @@ func (rr *RunRequest) String() string { // target. // func (rr *RunRequest) mergeHttpTarget(env *Environment, origTarget *Target, origHttpTarget *HttpTarget) { - if rr.Target.Opts.Duration > 0 && - rr.Target.Opts.Duration <= env.MaxAttackDuration { + if rr.Target.Opts.Duration > 0 && rr.Target.Opts.Duration <= env.MaxAttackDuration { origTarget.Opts.Duration = rr.Target.Opts.Duration } - if rr.Target.Opts.RatePerSecond > 0 && - rr.Target.Opts.RatePerSecond <= env.MaxAttackRate { + if rr.Target.Opts.RatePerSecond > 0 && rr.Target.Opts.RatePerSecond <= env.MaxAttackRate { origTarget.Opts.RatePerSecond = rr.Target.Opts.RatePerSecond origTarget.Opts.ratePerSecond = vegeta.Rate{ Freq: rr.Target.Opts.RatePerSecond, @@ -43,8 +41,7 @@ func (rr *RunRequest) mergeHttpTarget(env *Environment, origTarget *Target, orig } } - if rr.Target.Opts.Timeout > 0 && - rr.Target.Opts.Timeout <= DefaultAttackTimeout { + if rr.Target.Opts.Timeout > 0 && rr.Target.Opts.Timeout <= DefaultAttackTimeout { origTarget.Opts.Timeout = rr.Target.Opts.Timeout } @@ -63,13 +60,11 @@ func (rr *RunRequest) mergeHttpTarget(env *Environment, origTarget *Target, orig func (rr *RunRequest) mergeWebSocketTarget(env *Environment, origTarget *Target, origWebSocketTarget *WebSocketTarget, ) { - if rr.Target.Opts.Duration > 0 && - rr.Target.Opts.Duration <= env.MaxAttackDuration { + if rr.Target.Opts.Duration > 0 && rr.Target.Opts.Duration <= env.MaxAttackDuration { origTarget.Opts.Duration = rr.Target.Opts.Duration } - if rr.Target.Opts.RatePerSecond > 0 && - rr.Target.Opts.RatePerSecond <= env.MaxAttackRate { + if rr.Target.Opts.RatePerSecond > 0 && rr.Target.Opts.RatePerSecond <= env.MaxAttackRate { origTarget.Opts.RatePerSecond = rr.Target.Opts.RatePerSecond origTarget.Opts.ratePerSecond = vegeta.Rate{ Freq: rr.Target.Opts.RatePerSecond, @@ -77,8 +72,7 @@ func (rr *RunRequest) mergeWebSocketTarget(env *Environment, } } - if rr.Target.Opts.Timeout > 0 && - rr.Target.Opts.Timeout <= DefaultAttackTimeout { + if rr.Target.Opts.Timeout > 0 && rr.Target.Opts.Timeout <= DefaultAttackTimeout { origTarget.Opts.Timeout = rr.Target.Opts.Timeout } |
