MCPcopy Create free account
hub / github.com/antlr/codebuff / resync

Method resync

output/java_guava/1.4.16/SmoothRateLimiter.java:386–393  ·  view source on GitHub ↗

Updates storedPermits and nextFreeTicketMicros based on the current time.

(long nowMicros)

Source from the content-addressed store, hash-verified

384 */
385
386 void resync(long nowMicros) {
387 // if nextFreeTicket is in the past, resync to now
388 if (nowMicros > nextFreeTicketMicros) {
389 double newPermits = (nowMicros - nextFreeTicketMicros) / coolDownIntervalMicros();
390 storedPermits = min(maxPermits, storedPermits + newPermits);
391 nextFreeTicketMicros = nowMicros;
392 }
393 }
394}

Callers 2

doSetRateMethod · 0.95

Calls 2

minMethod · 0.45

Tested by

no test coverage detected