From a6dc26335fb166e60312102f91c18d7e31af39d6 Mon Sep 17 00:00:00 2001 From: wolflu05 <76838159+wolflu05@users.noreply.github.com> Date: Wed, 12 Jul 2023 13:57:44 +0000 Subject: [PATCH] Preload gunicorn app to only invoke the appconfig ready functions once --- InvenTree/gunicorn.conf.py | 3 +++ docker/gunicorn.conf.py | 3 +++ docs/_includes/gunicorn.conf.py | 3 +++ 3 files changed, 9 insertions(+) diff --git a/InvenTree/gunicorn.conf.py b/InvenTree/gunicorn.conf.py index b11999aadd..c1b403de12 100644 --- a/InvenTree/gunicorn.conf.py +++ b/InvenTree/gunicorn.conf.py @@ -8,3 +8,6 @@ workers = multiprocessing.cpu_count() * 2 + 1 max_requests = 1000 max_requests_jitter = 50 + +# preload app so that the ready functions are only executed once +preload_app = True diff --git a/docker/gunicorn.conf.py b/docker/gunicorn.conf.py index 750f293380..58b48a0c8d 100644 --- a/docker/gunicorn.conf.py +++ b/docker/gunicorn.conf.py @@ -37,3 +37,6 @@ logger.info(f"Starting gunicorn server with {workers} workers") max_requests = 1000 max_requests_jitter = 50 + +# preload app so that the ready functions are only executed once +preload_app = True diff --git a/docs/_includes/gunicorn.conf.py b/docs/_includes/gunicorn.conf.py index aeee2a366b..ee86c6f461 100644 --- a/docs/_includes/gunicorn.conf.py +++ b/docs/_includes/gunicorn.conf.py @@ -3,3 +3,6 @@ import multiprocessing bind = "0.0.0.0:8000" workers = multiprocessing.cpu_count() * 2 + 1 + +# preload app so that the ready functions are only executed once +preload_app = True