lifecycle: switch to h11 uvicorn worker for now

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-10-04 18:03:08 +02:00
parent 09f43ca43b
commit 83991c743e

View file

@ -1,7 +1,6 @@
"""Gunicorn config""" """Gunicorn config"""
import os import os
import pwd import pwd
import warnings
from multiprocessing import cpu_count from multiprocessing import cpu_count
import structlog import structlog
@ -17,7 +16,7 @@ try:
except KeyError: except KeyError:
pass pass
worker_class = "uvicorn.workers.UvicornWorker" worker_class = "uvicorn.workers.UvicornH11Worker"
# Docker containers don't have /tmp as tmpfs # Docker containers don't have /tmp as tmpfs
if os.path.exists("/dev/shm"): # nosec if os.path.exists("/dev/shm"): # nosec
worker_tmp_dir = "/dev/shm" # nosec worker_tmp_dir = "/dev/shm" # nosec
@ -61,28 +60,3 @@ else:
default_workers = max(cpu_count() * 0.25, 1) + 1 # Minimum of 2 workers default_workers = max(cpu_count() * 0.25, 1) + 1 # Minimum of 2 workers
workers = int(os.environ.get("WORKERS", default_workers)) workers = int(os.environ.get("WORKERS", default_workers))
threads = int(os.environ.get("THREADS", 4)) threads = int(os.environ.get("THREADS", 4))
warnings.filterwarnings(
"ignore",
message="defusedxml.lxml is no longer supported and will be removed in a future release.",
)
warnings.filterwarnings(
"ignore",
message="defusedxml.cElementTree is deprecated, import from defusedxml.ElementTree instead.",
)
warnings.filterwarnings(
"ignore",
message=(
"'django_prometheus' defines default_app_config = 'django_prometheus.apps.DjangoPromethe"
"usConfig'. Django now detects this configuration automatically. You can remove d"
"efault_app_config."
),
)
warnings.filterwarnings(
"ignore",
message=(
"'dbbackup' defines default_app_config = 'dbbackup.apps.DbbackupConfig'. Django now det"
"ects this configuration automatically. You can remove default_app_config."
),
)
warnings.simplefilter("once")