Skip to content

Commit

Permalink
WebHost: request maximum amount of file handles from the system for a…
Browse files Browse the repository at this point in the history
…utolauncher. (#625)

* WebHost: request maximum amount of file handles from the system for autolauncher.

* WebHostLib: wrap resource import into try to restore windows compatibility
  • Loading branch information
Berserker66 authored Jun 9, 2022
1 parent e69e42c commit 9a471af
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions WebHostLib/autolauncher.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9a471af

Please sign in to comment.