SteamWar/SpigotCore
Archiviert
13
0

Increase freeze conditions, fix watchdog timeout
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed

Dieser Commit ist enthalten in:
Lixfel 2024-01-18 01:36:17 +01:00
Ursprung 249efd7024
Commit 0c9048c346
2 geänderte Dateien mit 5 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -58,7 +58,7 @@ public class CheckpointUtils {
Bukkit.getOnlinePlayers().forEach(player -> player.kickPlayer(null)); Bukkit.getOnlinePlayers().forEach(player -> player.kickPlayer(null));
List<?> networkManagers = TinyProtocol.networkManagers.get(TinyProtocol.getServerConnection(Core.getInstance())); List<?> networkManagers = TinyProtocol.networkManagers.get(TinyProtocol.getServerConnection(Core.getInstance()));
if(!networkManagers.isEmpty()) { if(!Bukkit.getOnlinePlayers().isEmpty() || !networkManagers.isEmpty()) {
Core.getInstance().getLogger().log(Level.INFO, "Waiting for players to disconnect for checkpointing"); Core.getInstance().getLogger().log(Level.INFO, "Waiting for players to disconnect for checkpointing");
Bukkit.getScheduler().runTaskLater(Core.getInstance(), CheckpointUtils::freeze, 1); Bukkit.getScheduler().runTaskLater(Core.getInstance(), CheckpointUtils::freeze, 1);
return; return;

Datei anzeigen

@ -29,7 +29,7 @@ import java.util.stream.Collectors;
public class CrashDetector { public class CrashDetector {
private static final long TIMEOUT = 20000; private static final long TIMEOUT = 20_000_000_000L;
private final AtomicLong lastTick = new AtomicLong(Long.MAX_VALUE); private final AtomicLong lastTick = new AtomicLong(Long.MAX_VALUE);
private final AtomicLong lastMessage = new AtomicLong(Long.MAX_VALUE); private final AtomicLong lastMessage = new AtomicLong(Long.MAX_VALUE);
private final Thread mainThread = Thread.currentThread(); private final Thread mainThread = Thread.currentThread();
@ -39,8 +39,8 @@ public class CrashDetector {
public CrashDetector () { public CrashDetector () {
Bukkit.getScheduler().runTaskTimer(Core.getInstance(), () -> { Bukkit.getScheduler().runTaskTimer(Core.getInstance(), () -> {
lastTick.set(System.currentTimeMillis()); lastTick.set(System.nanoTime());
lastMessage.set(System.currentTimeMillis()); lastMessage.set(System.nanoTime());
}, 0, 1); }, 0, 1);
watchdog = new Thread(this::run, "SteamWar Watchdog"); watchdog = new Thread(this::run, "SteamWar Watchdog");
watchdog.setDaemon(true); watchdog.setDaemon(true);
@ -59,7 +59,7 @@ public class CrashDetector {
private void run() { private void run() {
SWException.init(); SWException.init();
while (run) { while (run) {
long curTime = System.currentTimeMillis(); long curTime = System.nanoTime();
if(curTime - 4*TIMEOUT >= lastTick.get()) { if(curTime - 4*TIMEOUT >= lastTick.get()) {
SWException.log("Server did not recover in " + (curTime - lastTick.get()) + "ms, unclean server stop", ""); SWException.log("Server did not recover in " + (curTime - lastTick.get()) + "ms, unclean server stop", "");
hardStop(); hardStop();