""" Gunicorn webserver configuration """ import multiprocessing import os from delphi_api.const import RELOAD_WORKERS, SERVICE_PORT bind = f'0.0.0.0:{SERVICE_PORT}' capture_output = True graceful_timeout = 30 # 30 seconds keepalive = 75 # 75 seconds – set higher than ELB idle timeout preload = True reload = RELOAD_WORKERS # Set the SO_REUSEPORT flag on the listening socket. reuse_port = True timeout = 30 # 30 seconds workers = int(os.getenv('WSGI_NUM_WORKERS', (multiprocessing.cpu_count() * 2 + 1))) threads = workers worker_class = 'gthread'