mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
073a275d89
* Skip ready functions if not in main thread or plugins are not loaded yet
* Debug integration tests
* Update ready.py
* Update ready.py
* Fix isInMainThread and isPluginRegistryLoaded ready functions
* Preload gunicorn app to only invoke the appconfig ready functions once
* debug: test prints for statistics
* Remove debug print
* Test without
* Revert "Test without"
This reverts commit 1bc1872893
.
* Second test
* Add checks back to part, label, user model
* Add checks back to inventree, plugin apps
* log server output for debugging
* hopefully I can get the log this time+
* Next test
* Test with --noreload
* Next test
* trigger: ci, because session expired
* block the second ready execution instead of the first
* fix: load order
* Fix test and revert gh actions workflow change
* Added all_apps method to reload machanism
* Changed detect reload mechanism
* Also trigger ready on reload
* Add skipping second reload back for testing mode
* Added doc string back
* Update InvenTree/plugin/base/integration/AppMixin.py
43 lines
1.0 KiB
Python
43 lines
1.0 KiB
Python
"""Gunicorn configuration for InvenTree."""
|
|
|
|
import logging
|
|
import multiprocessing
|
|
import os
|
|
|
|
# Logger configuration
|
|
logger = logging.getLogger('inventree')
|
|
accesslog = '-'
|
|
errorlog = '-'
|
|
loglevel = os.environ.get('INVENTREE_LOG_LEVEL', 'warning').lower()
|
|
capture_output = True
|
|
|
|
# Worker configuration
|
|
# TODO: Implement support for gevent
|
|
# worker_class = 'gevent' # Allow multi-threading support
|
|
worker_tmp_dir = '/dev/shm' # Write temp file to RAM (faster)
|
|
threads = 4
|
|
|
|
|
|
# Worker timeout (default = 90 seconds)
|
|
timeout = os.environ.get('INVENTREE_GUNICORN_TIMEOUT', 90)
|
|
|
|
# Number of worker processes
|
|
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
|
|
|
|
# preload app so that the ready functions are only executed once
|
|
preload_app = True
|