diff --git a/plugins/tst/src/main/java/kg/apc/jmeter/timers/VariableThroughputTimer.java b/plugins/tst/src/main/java/kg/apc/jmeter/timers/VariableThroughputTimer.java index a833ada33..168f0d01b 100644 --- a/plugins/tst/src/main/java/kg/apc/jmeter/timers/VariableThroughputTimer.java +++ b/plugins/tst/src/main/java/kg/apc/jmeter/timers/VariableThroughputTimer.java @@ -167,8 +167,14 @@ private int getDelay(long millisSinceLastSecond) { if (log.isDebugEnabled()) { log.debug("Calculating {} {} {}", millisSinceLastSecond, cntSent * msecPerReq, cntSent); } - if (millisSinceLastSecond < (cntSent * msecPerReq)) { - // TODO : Explain this for other maintainers + + + if (millisSinceLastSecond < (cntSent * msecPerReq) || msecPerReq > 1000) { + //this code allows for very big number of threads to be fired each second (at most 1 divided by how much time "delay" runs because it's synchronized) + //each second has number of requests to fire + //this condition evaluates to true if threads have been firing (executing "sample" and then executing "delay") quickly enough since the second started + //otherwise next thread should be fired instantly + // cntDelayed + 1 : Current threads waiting + this thread return (int) (1 + 1000.0 * (cntDelayed + 1) / rps); }