Filtered out ping under 0 and over 4000ms, increased ping data gather delay to 15s #684

This commit is contained in:
Rsl1122 2018-08-16 12:19:36 +03:00
parent 12073e9732
commit 23929d73ca
3 changed files with 7 additions and 7 deletions

View File

@ -52,7 +52,7 @@ public class PingMutator {
int max = -1; int max = -1;
for (Ping ping : pings) { for (Ping ping : pings) {
Integer value = ping.getMax(); Integer value = ping.getMax();
if (value < 0 || 8000 < value) { if (value <= 0 || 4000 < value) {
continue; continue;
} }
if (value > max) { if (value > max) {
@ -67,7 +67,7 @@ public class PingMutator {
int min = -1; int min = -1;
for (Ping ping : pings) { for (Ping ping : pings) {
Integer value = ping.getMin(); Integer value = ping.getMin();
if (value < 0 || 8000 < value) { if (value <= 0 || 4000 < value) {
continue; continue;
} }
if (value < min || min == -1) { if (value < min || min == -1) {
@ -80,7 +80,7 @@ public class PingMutator {
public double average() { public double average() {
return pings.stream().mapToDouble(Ping::getAverage) return pings.stream().mapToDouble(Ping::getAverage)
.filter(value -> value >= 0 && value <= 8000) .filter(value -> value > 0 && value <= 4000)
.average().orElse(-1); .average().orElse(-1);
} }
} }

View File

@ -37,7 +37,7 @@ public class PingInsertProcessor implements CriticalRunnable {
long lastDate = history.get(history.size() - 1).getDate(); long lastDate = history.get(history.size() - 1).getDate();
OptionalInt max = history.stream() OptionalInt max = history.stream()
.mapToInt(DateObj::getValue) .mapToInt(DateObj::getValue)
.filter(i -> i >= 0) .filter(i -> i > 0 && i < 4000)
.max(); .max();
if (!max.isPresent()) { if (!max.isPresent()) {
@ -46,12 +46,12 @@ public class PingInsertProcessor implements CriticalRunnable {
int minValue = history.stream() int minValue = history.stream()
.mapToInt(DateObj::getValue) .mapToInt(DateObj::getValue)
.filter(i -> i >= 0) .filter(i -> i > 0 && i < 4000)
.min().orElse(-1); .min().orElse(-1);
double avgValue = history.stream() double avgValue = history.stream()
.mapToInt(DateObj::getValue) .mapToInt(DateObj::getValue)
.filter(i -> i >= 0) .filter(i -> i > 0 && i < 4000)
.average().orElse(-1); .average().orElse(-1);
int maxValue = max.getAsInt(); int maxValue = max.getAsInt();

View File

@ -160,7 +160,7 @@ public class PingCountTimer extends AbsRunnable implements Listener {
addPlayer(player); addPlayer(player);
} }
} }
}).runTaskLater(TimeAmount.SECOND.ticks() * 10L); }).runTaskLater(TimeAmount.SECOND.ticks() * 15L);
} }
@EventHandler @EventHandler