2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-16 03:55:41 +00:00

Prevent multiple background workers without global cache (#8401)

* Prevent multiple background workers without global cache

* Documentation updates

- New page dedicated to InvenTree process stack
- Update links
- Consolidate information

* Update mkdocs.yml
This commit is contained in:
Oliver
2024-11-01 07:23:08 +11:00
committed by GitHub
parent 913a05cf45
commit 801b32e4e3
13 changed files with 143 additions and 113 deletions

View File

@ -221,6 +221,7 @@ class InfoView(AjaxView):
'instance': InvenTree.version.inventreeInstanceName(),
'apiVersion': InvenTree.version.inventreeApiVersion(),
'worker_running': is_worker_running(),
'worker_count': settings.BACKGROUND_WORKER_COUNT,
'worker_pending_tasks': self.worker_pending_tasks(),
'plugins_enabled': settings.PLUGINS_ENABLED,
'plugins_install_disabled': settings.PLUGINS_INSTALL_DISABLED,

View File

@ -851,13 +851,20 @@ _q_worker_timeout = int(
get_setting('INVENTREE_BACKGROUND_TIMEOUT', 'background.timeout', 90)
)
# Prevent running multiple background workers if global cache is disabled
# This is to prevent scheduling conflicts due to the lack of a shared cache
BACKGROUND_WORKER_COUNT = (
int(get_setting('INVENTREE_BACKGROUND_WORKERS', 'background.workers', 4))
if GLOBAL_CACHE_ENABLED
else 1
)
# django-q background worker configuration
Q_CLUSTER = {
'name': 'InvenTree',
'label': 'Background Tasks',
'workers': int(
get_setting('INVENTREE_BACKGROUND_WORKERS', 'background.workers', 4)
),
'workers': BACKGROUND_WORKER_COUNT,
'timeout': _q_worker_timeout,
'retry': max(120, _q_worker_timeout + 30),
'max_attempts': int(