Fix integer division in call link ratelimit leak rate
This commit is contained in:
parent
0889741f34
commit
34d77e73ff
|
@ -6,6 +6,11 @@
|
|||
package org.whispersystems.textsecuregcm.limits;
|
||||
|
||||
public record RateLimiterConfig(int bucketSize, double leakRatePerMinute) {
|
||||
public RateLimiterConfig {
|
||||
if (leakRatePerMinute <= 0) {
|
||||
throw new IllegalArgumentException("leakRatePerMinute cannot be less than or equal to zero");
|
||||
}
|
||||
}
|
||||
|
||||
public double leakRatePerMillis() {
|
||||
return leakRatePerMinute / (60.0 * 1000.0);
|
||||
|
|
|
@ -74,7 +74,7 @@ public class RateLimiters extends BaseRateLimiters<RateLimiters.For> {
|
|||
|
||||
PUSH_CHALLENGE_SUCCESS("pushChallengeSuccess", true, new RateLimiterConfig(2, 2.0 / (60 * 24))),
|
||||
|
||||
CREATE_CALL_LINK("createCallLink", false, new RateLimiterConfig(100, 100 / (60 * 24)));
|
||||
CREATE_CALL_LINK("createCallLink", false, new RateLimiterConfig(100, 100.0 / (60 * 24)));
|
||||
;
|
||||
|
||||
private final String id;
|
||||
|
|
Loading…
Reference in New Issue