From c10dd7cd02e8aa79fff26944143f4237e27134f3 Mon Sep 17 00:00:00 2001 From: Andrew Lalis Date: Fri, 5 Aug 2022 17:31:50 +0200 Subject: [PATCH] Increased registry update frequency. --- .../main/java/nl/andrewl/aos2registryapi/ServerRegistry.java | 4 ++-- server/src/main/java/nl/andrewl/aos2_server/Server.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/registry/src/main/java/nl/andrewl/aos2registryapi/ServerRegistry.java b/registry/src/main/java/nl/andrewl/aos2registryapi/ServerRegistry.java index 3437dcd..5d95131 100644 --- a/registry/src/main/java/nl/andrewl/aos2registryapi/ServerRegistry.java +++ b/registry/src/main/java/nl/andrewl/aos2registryapi/ServerRegistry.java @@ -26,8 +26,8 @@ import java.util.stream.Stream; public class ServerRegistry { private static final Logger log = LoggerFactory.getLogger(ServerRegistry.class); - public static final Duration SERVER_TIMEOUT = Duration.ofMinutes(5); - public static final Duration SERVER_MIN_UPDATE = Duration.ofMinutes(1); + public static final Duration SERVER_TIMEOUT = Duration.ofMinutes(3); + public static final Duration SERVER_MIN_UPDATE = Duration.ofSeconds(5); private final Map servers = new ConcurrentHashMap<>(); private final ServerInfoValidator infoValidator = new ServerInfoValidator(); diff --git a/server/src/main/java/nl/andrewl/aos2_server/Server.java b/server/src/main/java/nl/andrewl/aos2_server/Server.java index c757690..83ebafa 100644 --- a/server/src/main/java/nl/andrewl/aos2_server/Server.java +++ b/server/src/main/java/nl/andrewl/aos2_server/Server.java @@ -88,7 +88,7 @@ public class Server implements Runnable { new Thread(worldUpdater).start(); ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor(); var registryUpdater = new RegistryUpdater(this); - executorService.scheduleAtFixedRate(registryUpdater::sendUpdates, 0, 90, TimeUnit.SECONDS); + executorService.scheduleAtFixedRate(registryUpdater::sendUpdates, 0, 30, TimeUnit.SECONDS); System.out.printf("Started AoS2 Server on TCP/UDP port %d; now accepting connections.%n", serverSocket.getLocalPort()); while (running) { acceptClientConnection();