Files
yeuimu 4a7c44a354
CI / test (pull_request) Successful in 1m11s
feat: RIIN 商品拉取改用 goods/list 批量接口(200/批串行)替换逐单 order/goods
- api/riin/client.py: 新增 get_order_goods_batch(distribution/order/goods/list)
- flows/shared/clients.py: fetch_goods_concurrent → fetch_goods_for_orders,
  批量 200/批、串行、批间 2s,批级重试;移除逐单全局限速(340~500ms)机制
- flows/riin/_pipeline.py: 适配新批量拉取
- flows/shared/db.py: 存在性预查 unnest cast timestamp[] → timestamptz[]
  (入参为带时区偏移的 tz-aware datetime,timestamptz 才能稳定匹配)

背景:旧逐单接口高频被软限流(成功返回空 data),10-28 起日均缺口 13~33%;
批量接口调用量从日均 ~1 万次降到 ~50 次,已实测回补 7689 单/9717 条商品全量成功。
2026-10-31 10:01:50 +00:00

32 lines
1.1 KiB
Python

"""同步编排共享层:客户端/分页、映射、PG 写入、Artifacts。"""
from flows.shared import clients, db, mappers
from flows.shared.artifacts import build_stats_rows, emit_sync_summary, emit_verify_report
from flows.shared.clients import (
create_riin_client,
create_sds_client,
fetch_goods_for_orders,
fetch_riin_all_pages,
fetch_sds_all_pages,
floor_to_hour,
format_date,
get_channel_type_map,
refresh_channel_type_map,
resolve_courier_source,
start_of_day,
)
from flows.shared.db import SyncDB
from flows.shared.mappers import GoodsUpsertInput, OrderUpsertInput
from flows.shared.wecom import send_markdown, send_text
__all__ = [
"clients", "db", "mappers", "SyncDB",
"OrderUpsertInput", "GoodsUpsertInput",
"create_riin_client", "create_sds_client",
"fetch_riin_all_pages", "fetch_sds_all_pages", "fetch_goods_for_orders",
"get_channel_type_map", "refresh_channel_type_map", "resolve_courier_source",
"format_date", "start_of_day", "floor_to_hour",
"build_stats_rows", "emit_sync_summary", "emit_verify_report",
"send_markdown", "send_text",
]