Skip to content
This repository has been archived by the owner on Oct 16, 2018. It is now read-only.

Commit

Permalink
Merged #20 "CSAFE-5533: OG ops rate spikes briefly when transitioning…
Browse files Browse the repository at this point in the history
… between ops ramp and steady ops"
  • Loading branch information
Robert Veitch committed Oct 10, 2016
2 parents 59114fa + ee34879 commit cb4de92
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,10 @@ public RequestRateScheduler(final double rate, final TimeUnit unit, final double
final double requestsPerSecond = requestsPerSecond(rate, unit);

_logger.debug("Calculated requests per second [{}]", requestsPerSecond);
final RateLimiter steady = RateLimiter.create(requestsPerSecond);


if (DoubleMath.fuzzyEquals(rampup, 0.0, Math.pow(0.1, 6))) {
final RateLimiter steady = RateLimiter.create(requestsPerSecond);
this.permits.set(steady);
} else {
// two RateLimiters (ramp, steady) are used rather than one because the RateLimiter class
Expand All @@ -80,6 +81,7 @@ public void run() {
Uninterruptibles.sleepUninterruptibly(rampDuration, TimeUnit.NANOSECONDS);

_logger.debug("Swapping RateLimiter implementation from ramp to steady", rampDuration);
final RateLimiter steady = RateLimiter.create(requestsPerSecond);
RequestRateScheduler.this.permits.set(steady);

_logger.info("Finished ramp");
Expand Down

0 comments on commit cb4de92

Please sign in to comment.