This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"""Background extraction processor for handling extraction queue."""
|
||||
|
||||
import asyncio
|
||||
import contextlib
|
||||
|
||||
from sqlmodel.ext.asyncio.session import AsyncSession
|
||||
|
||||
@@ -51,10 +52,8 @@ class ExtractionProcessor:
|
||||
"Extraction processor did not stop gracefully, cancelling...",
|
||||
)
|
||||
self.processor_task.cancel()
|
||||
try:
|
||||
with contextlib.suppress(asyncio.CancelledError):
|
||||
await self.processor_task
|
||||
except asyncio.CancelledError:
|
||||
pass
|
||||
|
||||
logger.info("Extraction processor stopped")
|
||||
|
||||
@@ -84,8 +83,8 @@ class ExtractionProcessor:
|
||||
except TimeoutError:
|
||||
continue # Continue processing
|
||||
|
||||
except Exception as e:
|
||||
logger.exception("Error in extraction queue processor: %s", e)
|
||||
except Exception:
|
||||
logger.exception("Error in extraction queue processor")
|
||||
# Wait a bit before retrying to avoid tight error loops
|
||||
try:
|
||||
await asyncio.wait_for(self.shutdown_event.wait(), timeout=10.0)
|
||||
@@ -156,8 +155,8 @@ class ExtractionProcessor:
|
||||
result["status"],
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
logger.exception("Error processing extraction %d: %s", extraction_id, e)
|
||||
except Exception:
|
||||
logger.exception("Error processing extraction %d", extraction_id)
|
||||
|
||||
def _on_extraction_completed(self, extraction_id: int, task: asyncio.Task) -> None:
|
||||
"""Handle completion of an extraction task."""
|
||||
|
||||
Reference in New Issue
Block a user