openapi exception, retry, timeout finished

This commit is contained in:
Dohyun Lim committed 2026-01-27 16:34:48 +09:00
1 parent c7b77fb532
commit 1665d11d66
6 files changed
+277 -20

No files matched your search

+12 -1
View File
@@ -24,7 +24,7 @@ from app.home.schemas.home_schema import (
ProcessedInfo,
)
from app.utils.upload_blob_as_request import AzureBlobUploader
from app.utils.chatgpt_prompt import ChatgptService
from app.utils.chatgpt_prompt import ChatgptService, ChatGPTResponseError
from app.utils.common import generate_task_id
from app.utils.logger import get_logger
from app.utils.nvMapScraper import NvMapScraper, GraphQLException
@@ -293,6 +293,15 @@ async def _crawling_logic(url:str):
f"[crawling] Step 3 완료 - 마케팅 분석 성공 ({step3_elapsed:.1f}ms)"
)
except ChatGPTResponseError as e:
step3_elapsed = (time.perf_counter() - step3_start) * 1000
logger.error(
f"[crawling] Step 3 FAILED - ChatGPT Error: status={e.status}, "
f"code={e.error_code}, message={e.error_message} ({step3_elapsed:.1f}ms)"
)
marketing_analysis = None
gpt_status = "failed"
except Exception as e:
step3_elapsed = (time.perf_counter() - step3_start) * 1000
logger.error(
@@ -301,6 +310,7 @@ async def _crawling_logic(url:str):
logger.exception("[crawling] Step 3 상세 오류:")
# GPT 실패 시에도 크롤링 결과는 반환
marketing_analysis = None
gpt_status = "failed"
else:
step2_elapsed = (time.perf_counter() - step2_start) * 1000
logger.warning(
@@ -320,6 +330,7 @@ async def _crawling_logic(url:str):
logger.info(f"[crawling] - GPT API 호출: {step3_3_elapsed:.1f}ms")
return {
"status": gpt_status if 'gpt_status' in locals() else "completed",
"image_list": scraper.image_link_list,
"image_count": len(scraper.image_link_list) if scraper.image_link_list else 0,
"processed_info": processed_info,