ip 请求次数限制17
This commit is contained in:
@@ -65,6 +65,9 @@ public class IpAccessCounter {
|
|||||||
Set<String> removedIps = new HashSet<>();
|
Set<String> removedIps = new HashSet<>();
|
||||||
for (Map.Entry<String, List<Long>> entry : IP_ACCESS_TIMES.entrySet()) {
|
for (Map.Entry<String, List<Long>> entry : IP_ACCESS_TIMES.entrySet()) {
|
||||||
List<Long> accessTimes = entry.getValue();
|
List<Long> accessTimes = entry.getValue();
|
||||||
|
if (accessTimes == null || accessTimes.isEmpty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
accessTimes.removeIf(time -> currentTime - time > ONE_MINUTE);
|
accessTimes.removeIf(time -> currentTime - time > ONE_MINUTE);
|
||||||
if (accessTimes.isEmpty()) {
|
if (accessTimes.isEmpty()) {
|
||||||
removedIps.add(entry.getKey());
|
removedIps.add(entry.getKey());
|
||||||
|
|||||||
Reference in New Issue
Block a user