diff --git a/lib/run.js b/lib/run.js index 7111b7d9..31b6a174 100644 --- a/lib/run.js +++ b/lib/run.js @@ -152,9 +152,11 @@ function run (opts, tracker, cb) { const restartFn = () => { stop = false - stopTimer = setTimeout(() => { - stop = true - }, opts.duration * 1000) + if (!amount) { + stopTimer = setTimeout(() => { + stop = true + }, opts.duration * 1000) + } errors = 0 timeouts = 0 mismatches = 0 @@ -167,6 +169,7 @@ function run (opts, tracker, cb) { latencies.reset() throughput.reset() startTime = Date.now() + numRunning = opts.connections // reinitialise clients if (opts.overallRate && (opts.overallRate < opts.connections)) opts.connections = opts.overallRate