Merge pull request #697 from eitchtee/fix/db-pool-size

fix(settings): size DB pool from WEB_THREADS and PROCRASTINATE_WORKER_CONCURRENCY
This commit is contained in:
Herculino Trotta authored and GitHub committed 2026-11-20 13:28:05 -03:00
commit 9d6ce6ff1c
1 file changed
+6 -1
+6 -1
View File
@@ -147,7 +147,12 @@ WSGI_APPLICATION = "WYGIWYH.wsgi.application"
# Database
# https://docs.djangoproject.com/en/5.1/ref/settings/#databases
THREADS = int(os.getenv("GUNICORN_THREADS", 1))
# Web and task worker share these settings, so size every pool for whichever runs more threads.
# The pool opens connections on demand (min_size=1), so the larger cap costs nothing when idle.
THREADS = max(
int(os.getenv("WEB_THREADS") or os.getenv("GUNICORN_THREADS") or 1),
int(os.getenv("PROCRASTINATE_WORKER_CONCURRENCY") or 1),
)
MAX_POOL_SIZE = THREADS + 1
DATABASES = {