capcat.core.conversion_executor
File: Application/capcat/core/conversion_executor.py
Description
Shared executor pool for HTML-to-Markdown conversion to prevent nested ThreadPoolExecutor deadlock.
This module provides a global executor that can be safely used by multiple article processing threads without creating nested executors that exhaust thread resources.
Classes
ConversionExecutorPool
Singleton executor pool for HTML-to-Markdown conversions across all articles.
Methods
new
def __new__(cls)
Parameters:
cls
init
def __init__(self)
Initialize the shared executor pool.
Parameters:
self
executor
def executor(self) -> ThreadPoolExecutor
Get the shared executor instance.
Parameters:
self
Returns: ThreadPoolExecutor
shutdown
def shutdown(self, wait = True)
Shutdown the executor pool.
Parameters:
selfwaitoptional
Functions
get_conversion_executor
def get_conversion_executor() -> ThreadPoolExecutor
Get the shared HTML-to-Markdown conversion executor.
Returns: ThreadPoolExecutor: Shared executor for conversions
Returns: ThreadPoolExecutor
shutdown_conversion_executor
def shutdown_conversion_executor(wait = True)
Shutdown the shared conversion executor.
Args: wait: If True, wait for all tasks to complete
Parameters:
waitoptional