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) {
 | 
			
		||||
        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() {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user