count white&black list host requests for logging correct statistic
This commit is contained in:
parent
ae45a62f2f
commit
7bc74a1c7d
@ -61,13 +61,14 @@ public class HostRequestIntervalRegistry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public long tick(String clientHostId) {
|
public long tick(String clientHostId) {
|
||||||
|
IntervalCount intervalCount = hostCounts.computeIfAbsent(clientHostId, s -> new IntervalCount(intervalDurationMs));
|
||||||
|
long currentCount = intervalCount.resetIfExpiredAndTick();
|
||||||
if (whiteList.contains(clientHostId)) {
|
if (whiteList.contains(clientHostId)) {
|
||||||
return 0;
|
return 0;
|
||||||
} else if (blackList.contains(clientHostId)) {
|
} else if (blackList.contains(clientHostId)) {
|
||||||
return Long.MAX_VALUE;
|
return Long.MAX_VALUE;
|
||||||
}
|
}
|
||||||
IntervalCount intervalCount = hostCounts.computeIfAbsent(clientHostId, s -> new IntervalCount(intervalDurationMs));
|
return currentCount;
|
||||||
return intervalCount.resetIfExpiredAndTick();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clean() {
|
public void clean() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user