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 <noreply@anthropic.com>
This commit is contained in:
@@ -331,9 +331,12 @@ class CoupangAdapter(MarketplaceAdapter):
|
|||||||
out: list[dict[str, Any]] = []
|
out: list[dict[str, Any]] = []
|
||||||
for a, b in spans(start - timedelta(days=1), end, ORDER_SPAN_DAYS):
|
for a, b in spans(start - timedelta(days=1), end, ORDER_SPAN_DAYS):
|
||||||
for st in STATUSES:
|
for st in STATUSES:
|
||||||
rows = self._pages(ctx, path, {"createdAtFrom": f"{a.isoformat()}+09:00",
|
try:
|
||||||
"createdAtTo": f"{b.isoformat()}+09:00",
|
rows = self._pages(ctx, path, {"createdAtFrom": f"{a.isoformat()}+09:00",
|
||||||
"status": st, "maxPerPage": PAGE_SIZE})
|
"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)
|
out.extend(rows)
|
||||||
ctx.progress.step(items=len(rows))
|
ctx.progress.step(items=len(rows))
|
||||||
return out
|
return out
|
||||||
@@ -342,7 +345,11 @@ class CoupangAdapter(MarketplaceAdapter):
|
|||||||
path = RG_ORDERS_PATH.format(vendor=self._vendor(ctx))
|
path = RG_ORDERS_PATH.format(vendor=self._vendor(ctx))
|
||||||
out: list[dict[str, Any]] = []
|
out: list[dict[str, Any]] = []
|
||||||
for a, b in spans(start, end, RG_SPAN_DAYS):
|
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)
|
out.extend(rows)
|
||||||
ctx.progress.step(items=len(rows))
|
ctx.progress.step(items=len(rows))
|
||||||
return out
|
return out
|
||||||
|
|||||||
Reference in New Issue
Block a user