mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-12 18:15:40 +00:00
.devcontainer
.github
.vscode
InvenTree
ci
contrib
deploy
docker
production
docker-compose.sqlite.yml
gunicorn.conf.py
init.sh
nginx.dev.conf
requirements.txt
images
.eslintrc.yml
.gitattributes
.gitignore
.gitpod.yml
.pkgr.yml
.pre-commit-config.yaml
CONTRIBUTING.md
Dockerfile
LICENSE
Procfile
README.md
RELEASE.md
SECURITY.md
crowdin.yml
docker-compose.yml
docker.dev.env
package-lock.json
package.json
requirements-dev.in
requirements-dev.txt
requirements.in
requirements.txt
runtime.txt
setup.cfg
tasks.py
* Add bandit to pre-commit checks * fix catchall exceptions * remove unused definitons * remove unuseed ariables * Add docstring * fix B006, B008 errors * fix B007 error * ignore B009 * Add checks for formatting and naming
24 lines
489 B
Python
24 lines
489 B
Python
"""Gunicorn configuration for InvenTree."""
|
|
|
|
import logging
|
|
import multiprocessing
|
|
import os
|
|
|
|
logger = logging.getLogger('inventree')
|
|
|
|
workers = os.environ.get('INVENTREE_GUNICORN_WORKERS', None)
|
|
|
|
if workers is not None:
|
|
try:
|
|
workers = int(workers)
|
|
except ValueError:
|
|
workers = None
|
|
|
|
if workers is None:
|
|
workers = multiprocessing.cpu_count() * 2 + 1
|
|
|
|
logger.info(f"Starting gunicorn server with {workers} workers")
|
|
|
|
max_requests = 1000
|
|
max_requests_jitter = 50
|