count white&black list host requests for logging correct statistic

This commit is contained in:
vparomskiy 2018-03-15 11:34:16 +02:00
parent ae45a62f2f
commit 7bc74a1c7d

View File

@ -61,13 +61,14 @@ public class HostRequestIntervalRegistry {
}
public long tick(String clientHostId) {
IntervalCount intervalCount = hostCounts.computeIfAbsent(clientHostId, s -> new IntervalCount(intervalDurationMs));
long currentCount = intervalCount.resetIfExpiredAndTick();
if (whiteList.contains(clientHostId)) {
return 0;
} else if (blackList.contains(clientHostId)) {
return Long.MAX_VALUE;
}
IntervalCount intervalCount = hostCounts.computeIfAbsent(clientHostId, s -> new IntervalCount(intervalDurationMs));
return intervalCount.resetIfExpiredAndTick();
return currentCount;
}
public void clean() {