fix: 修复顺运宝采集任务孤儿状态 (#165)
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user