fix(v2): 退款自愈扫描加回溯窗(防 LIMIT 尾部饥饿)+ 清死行
RefundApplyTask 的候选查询按 out_trade_no ASC/id ASC 取前 200,succeeded 退款历史 只增不减、partially_refunded 长期驻留,超过 limit 后最新的崩溃窗口永远排在候选外 扫不到。两路查询都加 since 回溯窗:RefundStore.ListDistinctOutTradeNosByStatusSince (completed_at>=since)、OrderStore.ListOrdersByStatusSince(updated_at>=since),旧的 无窗方法原样保留。RefundApplyTask 新增 lookback/now 参数,config.ReconcileConfig 新增 RefundApplyLookbackMin(默认 48h)。顺带按 T6 复审补 OrderTTLMin 字段注释(须 ≫ crypto orderTTL 15min),清 sync_test.go 死行 `_ = time.Second`。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013nMthbVEmQquxBRKb9Fj8u
This commit is contained in:
@@ -77,7 +77,7 @@ func main() {
|
||||
runner.Add("paid-spotcheck", time.Duration(rc.SpotCheckEverySec)*time.Second,
|
||||
reconcile.PaidSpotCheckTask(orderStore, pReg, time.Duration(rc.SpotCheckWindowMin)*time.Minute, time.Now))
|
||||
runner.Add("refund-apply-sweep", time.Duration(rc.RefundApplyEverySec)*time.Second,
|
||||
reconcile.RefundApplyTask(orderStore, refundStore, 200))
|
||||
reconcile.RefundApplyTask(orderStore, refundStore, time.Duration(rc.RefundApplyLookbackMin)*time.Minute, time.Now, 200))
|
||||
runner.Add("refund-stuck-alert", time.Duration(rc.RefundApplyEverySec)*time.Second,
|
||||
reconcile.RefundStuckAlertTask(refundStore, time.Duration(rc.RefundStuckWarnMin)*time.Minute, time.Now))
|
||||
orphanStore := store.NewOrphanStore(db)
|
||||
|
||||
Reference in New Issue
Block a user