Properly setup interval counter

This commit is contained in:
Shane Freeder
2025-09-20 17:33:20 +01:00
parent fd41d512da
commit 81e4e99fbd

View File

@@ -46,8 +46,8 @@ public final class SimpleBytesPerSecondLimiter implements PacketLimiter {
throw new IllegalArgumentException("windowSeconds must be > 0"); throw new IllegalArgumentException("windowSeconds must be > 0");
} }
this.bytesPerSecond = bytesPerSecond; this.bytesPerSecond = bytesPerSecond;
this.packetsCounter = packetsPerSecond > 0 ? new IntervalledCounter(windowSeconds) : null; this.packetsCounter = packetsPerSecond > 0 ? new IntervalledCounter((long) (windowSeconds * 1.0e9)) : null;
this.bytesCounter = bytesPerSecond > 0 ? new IntervalledCounter(windowSeconds) : null; this.bytesCounter = bytesPerSecond > 0 ? new IntervalledCounter((long) (windowSeconds * 1.0e9)) : null;
} }