fix: increase hybrid engine cloud timeout for WIF token exchange (refs #182)
All checks were successful
Deploy to Staging / Build Images (pull_request) Successful in 37s
Deploy to Staging / Deploy to Staging (pull_request) Successful in 51s
Deploy to Staging / Verify Staging (pull_request) Successful in 9s
Deploy to Staging / Notify Staging Ready (pull_request) Successful in 8s
Deploy to Staging / Notify Staging Failure (pull_request) Has been skipped

The 5s cloud timeout was too tight for the initial WIF authentication
which requires 3 HTTP round-trips (STS, IAM credentials, resource
manager). First call took 5.5s and was discarded, falling back to slow
CPU-based PaddleOCR. Increased to 10s to accommodate cold-start auth.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Eric Gullickson
2026-02-13 21:38:05 -06:00
parent 5e4515da7c
commit 220f8ea3ac

View File

@@ -18,8 +18,11 @@ from app.engines.base_engine import (
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
# Maximum time (seconds) to wait for the cloud fallback # Maximum time (seconds) to wait for the cloud engine.
_CLOUD_TIMEOUT_SECONDS = 5.0 # WIF token exchange on first call requires 3 HTTP round-trips
# (STS -> IAM credentials -> resource manager) which can take 6-8s.
# Subsequent calls use cached tokens and are fast (<1s).
_CLOUD_TIMEOUT_SECONDS = 10.0
# Redis key prefix for monthly Vision API request counter # Redis key prefix for monthly Vision API request counter
_VISION_COUNTER_PREFIX = "ocr:vision_requests" _VISION_COUNTER_PREFIX = "ocr:vision_requests"