fix: 修复顺运宝采集任务孤儿状态 (#165)

This commit is contained in:
chengma
2026-08-11 17:00:33 +08:00
parent c8b1fd686a
commit 9e328984e9
17 changed files with 508 additions and 67 deletions
+17
View File
@@ -856,6 +856,23 @@ func TestCreatePddCollectTasks_采集中未超时的跳过并报数(t *testing.T
}
}
func TestCreatePddCollectTasks_采集中但任务已不存在可立即重建(t *testing.T) {
db := newTestDB(t)
createProduct(t, db, "100000000003")
if _, err := db.Exec(`UPDATE pdd_products SET collect_status='collecting',updated_at=? WHERE goods_id=?`,
model.NowISO(), "100000000003"); err != nil {
t.Fatal(err)
}
result, err := CreatePddCollectTasks(db, []string{"100000000003"})
if err != nil {
t.Fatalf("孤儿采集中状态重建失败: %v", err)
}
if result.Created != 1 || result.SkippedCollecting != 0 {
t.Fatalf("没有有效任务时应立即重建,实际 %+v", result)
}
}
// 采集失败的可以重新采集,不能一直卡在失败状态。
func TestCreatePddCollectTasks_失败的可以重新采集(t *testing.T) {
db := newTestDB(t)