Reduces webserver and task worker count to 1 by default

This commit is contained in:
Trenton Holmes
2022-07-11 13:54:04 -07:00
parent da8246d8c3
commit edaaedae36
5 changed files with 31 additions and 60 deletions

View File

@@ -425,27 +425,7 @@ LOGGING = {
# Task queue #
###############################################################################
# Sensible defaults for multitasking:
# use a fair balance between worker processes and threads epr worker so that
# both consuming many documents in parallel and consuming large documents is
# reasonably fast.
# Favors threads per worker on smaller systems and never exceeds cpu_count()
# in total.
def default_task_workers() -> int:
# always leave one core open
available_cores = max(multiprocessing.cpu_count(), 1)
try:
if available_cores < 4:
return available_cores
return max(math.floor(math.sqrt(available_cores)), 1)
except NotImplementedError:
return 1
TASK_WORKERS = __get_int("PAPERLESS_TASK_WORKERS", default_task_workers())
TASK_WORKERS = __get_int("PAPERLESS_TASK_WORKERS", 1)
PAPERLESS_WORKER_TIMEOUT: Final[int] = __get_int("PAPERLESS_WORKER_TIMEOUT", 1800)