Skip to content

Transforms complex documents like PDFs and Office docs into LLM-ready markdown/JSON for your Agentic workflows.

feat: make TASK_RESULT_TIMEOUT_SECONDS configurable via env var

crescenth0b9d9d7fc4c3
diff --git a/mineru/cli/api_client.py b/mineru/cli/api_client.py
index f04f2dae..f19b7db7 100644
--- a/mineru/cli/api_client.py
+++ b/mineru/cli/api_client.py
@@ -35,7 +35,6 @@ from mineru.utils.check_sys_env import is_linux_environment
HEALTH_ENDPOINT = "/health"
TASKS_ENDPOINT = "/tasks"
TASK_STATUS_POLL_INTERVAL_SECONDS = 1.0
-TASK_RESULT_TIMEOUT_SECONDS = 3600
LOCAL_API_SHUTDOWN_TIMEOUT_SECONDS = 10
LOCAL_API_CLEANUP_RETRIES = 8
LOCAL_API_CLEANUP_RETRY_INTERVAL_SECONDS = 0.25
@@ -86,6 +85,17 @@ def get_local_api_startup_timeout_seconds(default: float = 300.0) -> float:
LOCAL_API_STARTUP_TIMEOUT_SECONDS = get_local_api_startup_timeout_seconds()
+def get_task_result_timeout_seconds(default: float = 3600.0) -> float:
+ return get_float_env(
+ "MINERU_TASK_RESULT_TIMEOUT_SECONDS",
+ default,
+ minimum=1.0,
+ )
+
+
+TASK_RESULT_TIMEOUT_SECONDS = get_task_result_timeout_seconds()
+
+
def get_local_api_launch_mode(default: str = LOCAL_API_LAUNCH_MODE_SUBPROCESS) -> str:
value = os.getenv(MINERU_LOCAL_API_LAUNCH_MODE_ENV)
if value is None: