Fixed offline servers sometimes not being marked as offline on velocity
This commit is contained in:
+12
-10
@@ -52,16 +52,7 @@ public class BungeeServer implements AdaptedServer {
|
||||
|
||||
handle.ping((pp, error) -> {
|
||||
if(error != null) {
|
||||
|
||||
long lastOnline = lastSuccessfullPing == null ? 0 : lastSuccessfullPing.getFetchedTime();
|
||||
offlineTime = (int) Math.min(sent - lastOnline, Integer.MAX_VALUE);
|
||||
|
||||
lastOffline = sent;
|
||||
|
||||
future.completeExceptionally(error);
|
||||
lastPing = null;
|
||||
if(debug) logger.info("[pinger] [" + getName() + "] offline:", error);
|
||||
return;
|
||||
markOffline(debug, logger, future, sent, error);
|
||||
}
|
||||
|
||||
offlineTime = 0;
|
||||
@@ -80,6 +71,17 @@ public class BungeeServer implements AdaptedServer {
|
||||
return future;
|
||||
}
|
||||
|
||||
private void markOffline(boolean debug, QueueLogger logger, CompletableFuture<AdaptedServerPing> future, long sent, Throwable e) {
|
||||
long lastOnline = lastSuccessfullPing == null ? 0 : lastSuccessfullPing.getFetchedTime();
|
||||
offlineTime = (int) Math.min(sent - lastOnline, Integer.MAX_VALUE);
|
||||
|
||||
lastOffline = sent;
|
||||
|
||||
future.completeExceptionally(e);
|
||||
lastPing = null;
|
||||
if(debug) logger.info("[pinger] [" + getName() + "] offline:", e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<AdaptedServerPing> getLastPing() {
|
||||
return Optional.ofNullable(lastPing);
|
||||
|
||||
Reference in New Issue
Block a user