feat(v2): webhook 投递硬化——指数退避 + 最大次数死信 + 告警钩子(替裸 60s 猛敲)
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
// WebhookDelivery 是 pay→业务方 webhook 的 outbox(v2)。unique(out_trade_no,event_type,refund_id)
|
||||
// 保证同一订单同一事件(同一退款单)只入队一次(幂等);后台 Notifier 扫 Delivered=false 重试兜底。
|
||||
type WebhookDelivery struct {
|
||||
@@ -12,4 +14,7 @@ type WebhookDelivery struct {
|
||||
Delivered bool `gorm:"index;default:false" json:"delivered"`
|
||||
Attempts int `json:"attempts"`
|
||||
LastError string `gorm:"size:255" json:"last_error,omitempty"`
|
||||
|
||||
Dead bool `gorm:"index;default:false" json:"dead"` // 达最大次数放弃投递(死信),需人工/对账介入
|
||||
NextAttemptAt *time.Time `gorm:"index" json:"next_attempt_at,omitempty"` // 指数退避的下次可投时刻;nil=立即可投
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user