2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-20 13:56:30 +00:00

Specify how many workers to use

This commit is contained in:
Oliver
2021-07-29 16:37:34 +10:00
parent 935ef968de
commit dd12a593f4
3 changed files with 35 additions and 2 deletions

View File

@ -12,6 +12,7 @@ database setup in this file.
"""
import logging
from multiprocessing import Value
import os
import random
import string
@ -347,10 +348,22 @@ REST_FRAMEWORK = {
WSGI_APPLICATION = 'InvenTree.wsgi.application'
background_workers = os.environ.get('INVENTREE_BACKGROUND_WORKERS', None)
if background_workers is not None:
try:
background_workers = int(background_workers)
except ValueError:
background_workers = None
if background_workers is None:
# Sensible default?
background_workers = 4
# django-q configuration
Q_CLUSTER = {
'name': 'InvenTree',
'workers': 4,
'workers': background_workers,
'timeout': 90,
'retry': 120,
'queue_limit': 50,