fix: image parser concurrency error
This commit is contained in:
@@ -1042,14 +1042,6 @@ class BaseParser(ABC):
|
|||||||
Returns:
|
Returns:
|
||||||
Processed Chunk object
|
Processed Chunk object
|
||||||
"""
|
"""
|
||||||
# Set request ID context in the asynchronous task
|
|
||||||
try:
|
|
||||||
if current_request_id:
|
|
||||||
from utils.request import set_request_id
|
|
||||||
set_request_id(current_request_id)
|
|
||||||
logger.info(f"Chunk processing task #{chunk_idx+1} setting request ID: {current_request_id}")
|
|
||||||
except Exception as e:
|
|
||||||
logger.warning(f"Failed to set request ID in Chunk processing task: {str(e)}")
|
|
||||||
|
|
||||||
logger.info(f"Starting to process images in Chunk #{chunk_idx+1}/{total_chunks}")
|
logger.info(f"Starting to process images in Chunk #{chunk_idx+1}/{total_chunks}")
|
||||||
|
|
||||||
@@ -1146,7 +1138,7 @@ class BaseParser(ABC):
|
|||||||
# Create and run all Chunk concurrent processing tasks
|
# Create and run all Chunk concurrent processing tasks
|
||||||
async def process_all_chunks():
|
async def process_all_chunks():
|
||||||
# Set max concurrency, reduce concurrency to avoid resource contention
|
# Set max concurrency, reduce concurrency to avoid resource contention
|
||||||
max_concurrency = min(self.max_concurrent_tasks, 5) # Reduce concurrency
|
max_concurrency = min(self.max_concurrent_tasks, 1) # Reduce concurrency
|
||||||
# Use semaphore to limit concurrency
|
# Use semaphore to limit concurrency
|
||||||
semaphore = asyncio.Semaphore(max_concurrency)
|
semaphore = asyncio.Semaphore(max_concurrency)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user