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

Method resync

output/java_guava/1.4.19/SmoothRateLimiter.java:385–392  ·  view source on GitHub ↗

Updates storedPermits and nextFreeTicketMicros based on the current time.

(long nowMicros)

Source from the content-addressed store, hash-verified

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

Callers 2

doSetRateMethod · 0.95

Calls 2

minMethod · 0.45

Tested by

no test coverage detected