Increased registry update frequency.

This commit is contained in:
Andrew Lalis 2022-08-05 17:31:50 +02:00
parent e38ae65ff9
commit c10dd7cd02
2 changed files with 3 additions and 3 deletions

View File

@ -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<ServerIdentifier, ServerInfo> servers = new ConcurrentHashMap<>();
private final ServerInfoValidator infoValidator = new ServerInfoValidator();

View File

@ -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();