From 3331a686fa290b3d29ef6794fc2093b94dda2f44 Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Sat, 22 Jun 2019 00:59:33 -0700 Subject: [PATCH] Fix tess_threads clamped to 1 --- src/ocrmypdf/_sync.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ocrmypdf/_sync.py b/src/ocrmypdf/_sync.py index ffcb403d..daf332b1 100644 --- a/src/ocrmypdf/_sync.py +++ b/src/ocrmypdf/_sync.py @@ -232,8 +232,9 @@ def exec_concurrent(context): # parallelizing ocrmypdf and forcing Tesseract to be single threaded, which we # get by setting the envvar OMP_THREAD_LIMIT to 1. But if the page count of the # input file is small, then we allow Tesseract to use threads, subject to the - # constraint: (ocrmypdf workers) * (tesseract threads) <= max_workers - tess_threads = min(1, context.options.jobs // max_workers) + # constraint: (ocrmypdf workers) * (tesseract threads) <= max_workers and limiting + # Tesseract to 4 threads. + tess_threads = min(4, context.options.jobs // max_workers) if context.options.tesseract_env is None: context.options.tesseract_env = os.environ.copy() context.options.tesseract_env.setdefault('OMP_THREAD_LIMIT', str(tess_threads))