feat: 跳过判定改为覆盖率(缺图能补,抓全才跳过)
此前只要某场秀已入库 >=10 张就整场跳过,当初只成功抓了十几张的场次 剩下的图永远补不上。 - payload 增加 expected_images(本场应有张数,后端据此算覆盖率) - 跳过条件:images >= expected - 5;expected 未知时回落 10 张阈值 - 留 5 张余量:个别图在 Vogue 侧永久 404,要求一张不差会让这场秀 永远判不完整、每次全量抓都重下一遍
This commit is contained in:
@ -200,11 +200,11 @@ func ShowCoverageKey(year int, season, collectionType string) string {
|
||||
return strconv.Itoa(year) + "|" + season + "|" + collectionType
|
||||
}
|
||||
|
||||
// CoveredShows 取某品牌已入库的秀,返回「预检键 → 已有图片张数」。
|
||||
// CoveredShows 取某品牌已入库的秀,返回「预检键 → 覆盖情况」。
|
||||
//
|
||||
// 用途:抓取前整场跳过已入库的秀。图片 key 是内容 sha1,不下载就无法知道
|
||||
// 用途:抓取前整场跳过已经抓全的秀。图片 key 是内容 sha1,不下载就无法知道
|
||||
// 一张图是否已经存在,所以「跳过」只能在场这一级做。
|
||||
func (c *Client) CoveredShows(ctx context.Context, brandUID string) (map[string]int, error) {
|
||||
func (c *Client) CoveredShows(ctx context.Context, brandUID string) (map[string]ShowCoverage, error) {
|
||||
if c == nil || c.Endpoint == "" {
|
||||
return nil, fmt.Errorf("ingest client 未配置")
|
||||
}
|
||||
@ -237,9 +237,9 @@ func (c *Client) CoveredShows(ctx context.Context, brandUID string) (map[string]
|
||||
if err := json.Unmarshal(raw, &out); err != nil {
|
||||
return nil, fmt.Errorf("shows/covered 解析失败: %w", err)
|
||||
}
|
||||
covered := make(map[string]int, len(out.Items))
|
||||
covered := make(map[string]ShowCoverage, len(out.Items))
|
||||
for _, it := range out.Items {
|
||||
covered[ShowCoverageKey(int(it.Year), it.Season, it.CollectionType)] = it.Images
|
||||
covered[ShowCoverageKey(int(it.Year), it.Season, it.CollectionType)] = it
|
||||
}
|
||||
return covered, nil
|
||||
}
|
||||
@ -287,7 +287,10 @@ type ShowCoverage struct {
|
||||
Year uint16 `json:"year"`
|
||||
Season string `json:"season"`
|
||||
CollectionType string `json:"collection_type"`
|
||||
Images int `json:"images"`
|
||||
// Images 库里实际图片张数。
|
||||
Images int `json:"images"`
|
||||
// Expected 应有张数(spider 上次上报)。0 表示历史数据没有记录,判定时退化为阈值。
|
||||
Expected int `json:"expected"`
|
||||
}
|
||||
|
||||
func (c *Client) FetchPendingEmbeddings(ctx context.Context, kind string, limit int) ([]PendingEmbedding, int, error) {
|
||||
|
||||
Reference in New Issue
Block a user