From 9edab76567dec3c3e5ef5300287585803c7f0802 Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Sun, 30 Apr 2023 07:13:24 +0200 Subject: [PATCH] WebHost: recycle generator processes --- WebHostLib/__init__.py | 2 +- WebHostLib/autolauncher.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/WebHostLib/__init__.py b/WebHostLib/__init__.py index 8bd3609c..a59e3aa5 100644 --- a/WebHostLib/__init__.py +++ b/WebHostLib/__init__.py @@ -34,7 +34,7 @@ app.config['MAX_CONTENT_LENGTH'] = 64 * 1024 * 1024 # 64 megabyte limit # if you want to deploy, make sure you have a non-guessable secret key app.config["SECRET_KEY"] = bytes(socket.gethostname(), encoding="utf-8") # at what amount of worlds should scheduling be used, instead of rolling in the web-thread -app.config["JOB_THRESHOLD"] = 2 +app.config["JOB_THRESHOLD"] = 1 # after what time in seconds should generation be aborted, freeing the queue slot. Can be set to None to disable. app.config["JOB_TIME"] = 600 app.config['SESSION_PERMANENT'] = True diff --git a/WebHostLib/autolauncher.py b/WebHostLib/autolauncher.py index 484755b3..0475a632 100644 --- a/WebHostLib/autolauncher.py +++ b/WebHostLib/autolauncher.py @@ -135,7 +135,7 @@ def autogen(config: dict): with Locker("autogen"): with multiprocessing.Pool(config["GENERATORS"], initializer=init_db, - initargs=(config["PONY"],)) as generator_pool: + initargs=(config["PONY"],), maxtasksperchild=10) as generator_pool: with db_session: to_start = select(generation for generation in Generation if generation.state == STATE_STARTED)