forked from MinecraftUtilities/Backend
maybe fix
This commit is contained in:
parent
aa69970ec7
commit
ad83e270b6
@ -191,9 +191,7 @@ public class MojangService {
|
|||||||
return endpointStatus.get();
|
return endpointStatus.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
List<CompletableFuture<Void>> futures = new ArrayList<>();
|
MOJANG_ENDPOINTS.parallelStream().forEach(endpoint -> {
|
||||||
for (EndpointStatus endpoint : MOJANG_ENDPOINTS) {
|
|
||||||
futures.add(CompletableFuture.runAsync(() -> {
|
|
||||||
try {
|
try {
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
InetAddress address = InetAddress.getByName(endpoint.getHostname());
|
InetAddress address = InetAddress.getByName(endpoint.getHostname());
|
||||||
@ -208,10 +206,7 @@ public class MojangService {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
endpoint.setStatus(EndpointStatus.Status.OFFLINE);
|
endpoint.setStatus(EndpointStatus.Status.OFFLINE);
|
||||||
}
|
}
|
||||||
}));
|
});
|
||||||
}
|
|
||||||
|
|
||||||
CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join();
|
|
||||||
|
|
||||||
log.info("Fetched Mojang API status for {} endpoints", MOJANG_ENDPOINTS.size());
|
log.info("Fetched Mojang API status for {} endpoints", MOJANG_ENDPOINTS.size());
|
||||||
CachedEndpointStatus status = new CachedEndpointStatus(
|
CachedEndpointStatus status = new CachedEndpointStatus(
|
||||||
|
Loading…
Reference in New Issue
Block a user