From ee2290da282cb05a09e7e5584d54a48450d61541 Mon Sep 17 00:00:00 2001
From: Oliver <oliver.henry.walters@gmail.com>
Date: Tue, 10 Jan 2023 07:53:57 +1100
Subject: [PATCH] Gunicorn options (#4192)

* Add option for controlling gunicorn timeout

* Adds gunicorn timeout as docker env variable
---
 docker/gunicorn.conf.py | 5 +++++
 docker/production/.env  | 3 +++
 2 files changed, 8 insertions(+)

diff --git a/docker/gunicorn.conf.py b/docker/gunicorn.conf.py
index a12a1c8436..6f22cf220c 100644
--- a/docker/gunicorn.conf.py
+++ b/docker/gunicorn.conf.py
@@ -17,6 +17,11 @@ capture_output = True
 worker_tmp_dir = '/dev/shm'  # Write temp file to RAM (faster)
 threads = 4
 
+
+# Worker timeout (default = 30 seconds)
+timeout = os.environ.get('INVENTREE_GUNICORN_TIMEOUT', 30)
+
+# Number of worker processes
 workers = os.environ.get('INVENTREE_GUNICORN_WORKERS', None)
 
 if workers is not None:
diff --git a/docker/production/.env b/docker/production/.env
index 343e3965fa..c465f03a28 100644
--- a/docker/production/.env
+++ b/docker/production/.env
@@ -41,6 +41,9 @@ INVENTREE_DB_PORT=5432
 #INVENTREE_CACHE_HOST=inventree-cache
 #INVENTREE_CACHE_PORT=6379
 
+# Options for gunicorn server
+INVENTREE_GUNICORN_TIMEOUT=30
+
 # Enable custom plugins?
 INVENTREE_PLUGINS_ENABLED=False