mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-21 05:48:04 +01:00
Fix integer division in call link ratelimit leak rate
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user