fix: lucky_gift_outbox delivered 保留期收紧为 7 天
线上实测 delivered 约 9 万行/天且该表无下游读方(事实在 lucky_draw_records), 30 天窗口会让表膨胀到近 300 万行;7 天足够排障。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
79e60f3815
commit
551ad9b03a
@ -74,8 +74,9 @@ func Default() Config {
|
|||||||
StatsRefreshInterval: 10 * time.Minute,
|
StatsRefreshInterval: 10 * time.Minute,
|
||||||
StatsBatchSize: 5000,
|
StatsBatchSize: 5000,
|
||||||
Retention: OutboxRetentionConfig{
|
Retention: OutboxRetentionConfig{
|
||||||
Enabled: true,
|
Enabled: true,
|
||||||
MaxAge: 30 * 24 * time.Hour,
|
// 线上 delivered 约 9 万行/天且无下游读方;7 天足够排障,30 天会让表膨胀到近 300 万行。
|
||||||
|
MaxAge: 7 * 24 * time.Hour,
|
||||||
ScanInterval: 5 * time.Minute,
|
ScanInterval: 5 * time.Minute,
|
||||||
BatchSize: 500,
|
BatchSize: 500,
|
||||||
},
|
},
|
||||||
|
|||||||
@ -17,8 +17,8 @@ func TestLoadDefaultsEnableOutboxRetention(t *testing.T) {
|
|||||||
if !retention.Enabled {
|
if !retention.Enabled {
|
||||||
t.Fatal("retention should be enabled by default")
|
t.Fatal("retention should be enabled by default")
|
||||||
}
|
}
|
||||||
if retention.MaxAge != 30*24*time.Hour {
|
if retention.MaxAge != 7*24*time.Hour {
|
||||||
t.Fatalf("retention.MaxAge = %s, want 720h", retention.MaxAge)
|
t.Fatalf("retention.MaxAge = %s, want 168h", retention.MaxAge)
|
||||||
}
|
}
|
||||||
if retention.ScanInterval != 5*time.Minute {
|
if retention.ScanInterval != 5*time.Minute {
|
||||||
t.Fatalf("retention.ScanInterval = %s, want 5m", retention.ScanInterval)
|
t.Fatalf("retention.ScanInterval = %s, want 5m", retention.ScanInterval)
|
||||||
|
|||||||
@ -23,9 +23,10 @@ type OutboxRetentionOptions struct {
|
|||||||
|
|
||||||
func defaultOutboxRetentionOptions() OutboxRetentionOptions {
|
func defaultOutboxRetentionOptions() OutboxRetentionOptions {
|
||||||
// 默认值和 config.Default 的 retention 保持一致,防止手动构造绕过配置归一化后误删新事件。
|
// 默认值和 config.Default 的 retention 保持一致,防止手动构造绕过配置归一化后误删新事件。
|
||||||
|
// 线上 delivered 约 9 万行/天且无下游读方,7 天窗口在可排障和表体积之间取平衡。
|
||||||
return OutboxRetentionOptions{
|
return OutboxRetentionOptions{
|
||||||
ScanInterval: 5 * time.Minute,
|
ScanInterval: 5 * time.Minute,
|
||||||
MaxAge: 30 * 24 * time.Hour,
|
MaxAge: 7 * 24 * time.Hour,
|
||||||
BatchSize: 500,
|
BatchSize: 500,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user