Make progress pool common rather than plugin-specific

This commit is contained in:
James R. Barlow
2021-01-24 23:56:09 -08:00
parent 3bd5054634
commit 386cabff00
3 changed files with 32 additions and 35 deletions
+8 -12
View File
@@ -11,7 +11,6 @@
import logging
import logging.handlers
import signal
import threading
from contextlib import suppress
from enum import Enum, auto
from itertools import islice, repeat, takewhile, zip_longest
@@ -23,8 +22,6 @@ from unittest.mock import Mock
from ocrmypdf import hookimpl
from ocrmypdf.exceptions import InputFileError
pool_lock = threading.Lock()
class MessageType(Enum):
exception = auto()
@@ -101,15 +98,14 @@ def lambda_pool_impl(
task_finished(result, pbar)
return
with pool_lock:
_lambda_pool_impl(
max_workers=max_workers,
worker_initializer=worker_initializer,
task=task,
task_arguments=task_arguments,
task_finished=task_finished,
pbar=pbar,
)
_lambda_pool_impl(
max_workers=max_workers,
worker_initializer=worker_initializer,
task=task,
task_arguments=task_arguments,
task_finished=task_finished,
pbar=pbar,
)
def _lambda_pool_impl(