From bbd736e915aaee783696f6e775ebfcb68729068c Mon Sep 17 00:00:00 2001 From: Antti Kettunen Date: Sat, 18 Apr 2026 13:43:10 +0300 Subject: [PATCH] Reduce gunicorn graceful_timeout to speed up app teardown The app goes through the usual teardown process quite fast on it's own, so keeping the graceful timeout config high only arbitrarily slows things down. This is especially releavnt in dev mode, since app reloads should feel snappy when changes are made --- gunicorn.conf.py | 3 +++ gunicorn.dev.conf.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/gunicorn.conf.py b/gunicorn.conf.py index 65b4183e..0500e468 100644 --- a/gunicorn.conf.py +++ b/gunicorn.conf.py @@ -8,6 +8,9 @@ threads = 8 # Keep requests from hanging forever on slow external services. timeout = 120 +# Keep shutdowns under Docker's stop window so container restarts stay graceful. +graceful_timeout = 8 + # Logging goes to stdout/stderr so Docker can collect it. accesslog = "-" errorlog = "-" diff --git a/gunicorn.dev.conf.py b/gunicorn.dev.conf.py index f1e31beb..6a4c73a1 100644 --- a/gunicorn.dev.conf.py +++ b/gunicorn.dev.conf.py @@ -9,6 +9,9 @@ reload = True # Keep requests from hanging forever on slow external services. timeout = 120 +# Don't let local reloads wait too long for shutdown. +graceful_timeout = 1 + # Logging goes to stdout/stderr so the shell launcher can collect it. accesslog = "-" errorlog = "-"