import multiprocessing # Bind address — change to a Unix socket for nginx proxy: # bind = 'unix:/tmp/magic.sock' # bind = '0.0.0.0:5000' # One worker per CPU core, +1. Keep at 2 minimum for SQLite (WAL mode handles # concurrent reads; writes are serialised at the SQLite layer). workers = max(2, multiprocessing.cpu_count() + 1) # Use threads inside each worker for extra concurrency without extra processes. worker_class = 'gthread' threads = 4 # Kill and restart a worker after this many requests to prevent memory leaks. max_requests = 1000 max_requests_jitter = 100 timeout = 60 keepalive = 5 # Pre-fork the app once so all workers share the loaded config. preload_app = True # Log to stdout so systemd / docker can capture it. accesslog = '-' errorlog = '-' loglevel = 'info'