diff --git a/WebHostLib/autolauncher.py b/WebHostLib/autolauncher.py index 522bbdd18a49..9d7b7f4959d4 100644 --- a/WebHostLib/autolauncher.py +++ b/WebHostLib/autolauncher.py @@ -210,6 +210,16 @@ def run_guardian(): global multiworlds with guardian_lock: if not guardian: + try: + import resource + except ModuleNotFoundError: + pass # unix only module + else: + # Each Server is another file handle, so request as many as we can from the system + file_limit = resource.getrlimit(resource.RLIMIT_NOFILE)[1] + # set soft limit to hard limit + resource.setrlimit(resource.RLIMIT_NOFILE, (file_limit, file_limit)) + def guard(): while 1: time.sleep(1)