explicit conversion timeout and handling

This commit is contained in:
2026-03-26 18:56:28 -07:00
parent aa5dcddaa3
commit 8e93f75257
7 changed files with 65 additions and 16 deletions
@@ -16,6 +16,9 @@ class ServerConfig:
s3_secure: bool
s3_public_endpoint: str
s3_session_ttl_seconds: int
conversion_image_dpi: int
conversion_pptx_to_pdf_timeout_seconds: int
conversion_pdf_to_images_timeout_seconds: int
conversion_cleanup_delay_seconds: int
@@ -28,6 +31,13 @@ def load_server_config() -> ServerConfig:
s3_secure=os.getenv("S3_USE_SSL", "false").lower() == "true",
s3_public_endpoint=os.getenv("S3_PUBLIC_ENDPOINT", "localhost:8333"),
s3_session_ttl_seconds=int(os.getenv("S3_SESSION_TTL_SECONDS", "3600")),
conversion_image_dpi=int(os.getenv("CONVERSION_IMAGE_DPI", "150")),
conversion_pptx_to_pdf_timeout_seconds=int(
os.getenv("CONVERSION_PPTX_TO_PDF_TIMEOUT_SECONDS", "180")
),
conversion_pdf_to_images_timeout_seconds=int(
os.getenv("CONVERSION_PDF_TO_IMAGES_TIMEOUT_SECONDS", "600")
),
conversion_cleanup_delay_seconds=int(
os.getenv("CONVERSION_CLEANUP_DELAY_SECONDS", "3600")
),
@@ -182,6 +182,9 @@ class ConversionServiceImpl(conversion_connect.ConversionService):
convert_pptx_to_slidedeck,
source_path,
work_dir,
dpi=self._config.conversion_image_dpi,
pptx_to_pdf_timeout_s=self._config.conversion_pptx_to_pdf_timeout_seconds,
pdf_to_images_timeout_s=self._config.conversion_pdf_to_images_timeout_seconds,
)
session.slide_deck = await asyncio.to_thread(
self._upload_and_build_slide_deck,