Further fixes to prevent the 404 message returned from cache even when bukkit servers are online #412

This commit is contained in:
Rsl1122 2017-11-28 17:05:41 +02:00
parent a84b470be5
commit 9c045b7b0b
3 changed files with 10 additions and 2 deletions

View File

@ -174,6 +174,8 @@ public class BungeeInformationManager extends InformationManager {
try {
getWebAPI().getAPI(IsOnlineWebAPI.class).sendRequest(server.getWebAddress(), uuid);
return server;
} catch (WebAPIConnectionFailException e) {
serverInfoManager.serverHasGoneOffline(server.getUuid());
} catch (WebAPINotFoundException ignored) {
/*continue*/
} catch (WebAPIException e) {
@ -182,7 +184,7 @@ public class BungeeInformationManager extends InformationManager {
}
}
Optional<ServerInfo> bukkitServer = onlineServers.stream().findAny();
Optional<ServerInfo> bukkitServer = serverInfoManager.getOnlineBukkitServers().stream().findAny();
if (bukkitServer.isPresent()) {
return bukkitServer.get();
}

View File

@ -148,6 +148,7 @@ public class BungeeServerInfoManager {
@Override
public void run() {
sendConfigSettings(serverUUID);
connectedToServer(bukkitServers.get(serverUUID));
this.cancel();
}
}).runTaskLaterAsynchronously(TimeAmount.SECOND.ticks() * 3L);

View File

@ -207,7 +207,12 @@ public class ResponseHandler extends APIResponseHandler {
}
plugin.getInfoManager().cachePlayer(uuid);
return PageCache.loadPage("inspectPage: " + uuid, () -> new InspectPageResponse(plugin.getInfoManager(), uuid));
Response response = PageCache.loadPage("inspectPage: " + uuid);
if (response == null || response instanceof NotFoundResponse) {
PageCache.cachePage("inspectPage: " + uuid, () -> new InspectPageResponse(plugin.getInfoManager(), uuid));
response = PageCache.loadPage("inspectPage: " + uuid);
}
return response;
}
private Response notFoundResponse() {