fix: Ollama 타임아웃 60s->180s + 에러 타입 로깅 + 텔레그램 chat.id 디버그

This commit is contained in:
2026-04-13 02:33:55 +09:00
parent 1d535519ef
commit 5dd7b6d601
2 changed files with 8 additions and 4 deletions

View File

@@ -76,11 +76,14 @@ async def summarize_news(articles: List[Dict[str, Any]]) -> Dict[str, Any]:
started = time.monotonic()
try:
async with httpx.AsyncClient(timeout=60.0) as client:
# qwen3:14b 첫 모델 로드 + 장문 추론은 60s로는 부족 → 180s로 확장
async with httpx.AsyncClient(timeout=180.0) as client:
resp = await client.post(url, json=payload)
except httpx.HTTPError as e:
logger.error(f"Ollama 연결 실패 ({url}): {e}")
raise OllamaError(f"Ollama 연결 실패: {e}") from e
err_type = type(e).__name__
err_msg = str(e) or "(no message)"
logger.error(f"Ollama 연결 실패 ({url}): [{err_type}] {err_msg}")
raise OllamaError(f"Ollama 연결 실패: [{err_type}] {err_msg}") from e
if resp.status_code != 200:
logger.error(f"Ollama 응답 오류 {resp.status_code}: {resp.text[:200]}")