From d5fd617425dd63a069073de61449fa6be1f90f0c Mon Sep 17 00:00:00 2001 From: king Date: Tue, 13 Oct 2026 05:49:17 +0900 Subject: [PATCH] fix(performance): coupang API errors name the failing period and status Long updates are split into 31-day (seller) / 30-day (Rocket Growth) calls; the error now says which window failed so long-range failures can be diagnosed. Co-Authored-By: Claude Opus 5.5 --- app/modules/performance/adapters/coupang.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/app/modules/performance/adapters/coupang.py b/app/modules/performance/adapters/coupang.py index 73710f1..8dc28a6 100644 --- a/app/modules/performance/adapters/coupang.py +++ b/app/modules/performance/adapters/coupang.py @@ -331,9 +331,12 @@ class CoupangAdapter(MarketplaceAdapter): out: list[dict[str, Any]] = [] for a, b in spans(start - timedelta(days=1), end, ORDER_SPAN_DAYS): for st in STATUSES: - rows = self._pages(ctx, path, {"createdAtFrom": f"{a.isoformat()}+09:00", - "createdAtTo": f"{b.isoformat()}+09:00", - "status": st, "maxPerPage": PAGE_SIZE}) + try: + rows = self._pages(ctx, path, {"createdAtFrom": f"{a.isoformat()}+09:00", + "createdAtTo": f"{b.isoformat()}+09:00", + "status": st, "maxPerPage": PAGE_SIZE}) + except ApiError as exc: # 긴 기간을 나눠 부를 때 어느 구간에서 막혔는지 알 수 있게 + raise ApiError(f"{exc.message} [주문일 {a.isoformat()}~{b.isoformat()}, 상태 {st}]") from None out.extend(rows) ctx.progress.step(items=len(rows)) return out @@ -342,7 +345,11 @@ class CoupangAdapter(MarketplaceAdapter): path = RG_ORDERS_PATH.format(vendor=self._vendor(ctx)) out: list[dict[str, Any]] = [] for a, b in spans(start, end, RG_SPAN_DAYS): - rows = self._pages(ctx, path, {"paidDateFrom": a.strftime("%Y%m%d"), "paidDateTo": b.strftime("%Y%m%d")}, rg=True) + try: + rows = self._pages(ctx, path, {"paidDateFrom": a.strftime("%Y%m%d"), "paidDateTo": b.strftime("%Y%m%d")}, + rg=True) + except ApiError as exc: + raise ApiError(f"{exc.message} [로켓그로스 결제일 {a.isoformat()}~{b.isoformat()}]") from None out.extend(rows) ctx.progress.step(items=len(rows)) return out