From 98c97964cc0d7db4d70538e32bdb8628c97f35d1 Mon Sep 17 00:00:00 2001 From: Charles Le Maux Date: Mon, 19 Aug 2024 11:58:10 +0200 Subject: [PATCH] [+] New launching flags test --- generic_executor.py | 1 - server_mc_manager.py | 11 ++++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/generic_executor.py b/generic_executor.py index 6f47f46..f5b1699 100644 --- a/generic_executor.py +++ b/generic_executor.py @@ -74,7 +74,6 @@ def fetch_logs(user: UserRecord, name: str) -> tuple[HTTPStatus, Union[str, None try: with open(log_file, "r") as f: logs = f.readlines()[-lines_to_read:] - text_logs = f.read() return HTTPStatus.OK, str(logs) except FileNotFoundError: return HTTPStatus.NOT_FOUND, "Log file not found." diff --git a/server_mc_manager.py b/server_mc_manager.py index 48a3107..138968c 100644 --- a/server_mc_manager.py +++ b/server_mc_manager.py @@ -21,7 +21,16 @@ class MinecraftServerManager: if port in self.servers: return None - command = f"{java_executable} -Xmx{memory_size} -Xms{memory_size} -jar {jar_file} --nogui > /dev/null" + reg_flags: str = ("-XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200" + " -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch" + " -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M" + " -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4" + " -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90" + " -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem" + " -XX:MaxTenuringThreshold=1 -Daikars.new.flags=true" + " -Dusing.aikars.flags=https://mcutils.com") + + command = f"{java_executable} -Xmx{memory_size} {reg_flags} -jar {jar_file} --nogui" process = subprocess.Popen(shlex.split(command), cwd=server_directory, stdin=subprocess.PIPE) self.servers_count = len(self.servers) + 1