feat(adapter): externalize platform worker runtime tuning

This commit is contained in:
Your Name
2026-05-06 10:54:08 +08:00
parent cbbb553e9f
commit 16e53361f2
7 changed files with 183 additions and 18 deletions

View File

@@ -110,6 +110,9 @@ func TestNew_RegistersPlatformWebhookRouteWhenSub2APIEnabled(t *testing.T) {
cfg.PlatformAdapters.Enabled = true
cfg.PlatformAdapters.Sub2API.Enabled = true
cfg.PlatformAdapters.Sub2API.IngressSecret = "sub2api-secret"
cfg.PlatformAdapters.Sub2API.CallbackPollIntervalMS = 2500
cfg.PlatformAdapters.Sub2API.CallbackBatchSize = 8
cfg.PlatformAdapters.Sub2API.CallbackRetrySchedule = []int{5, 15, 45}
app, err := New(cfg, logging.New())
if err != nil {
@@ -124,6 +127,13 @@ func TestNew_RegistersPlatformWebhookRouteWhenSub2APIEnabled(t *testing.T) {
}
}
func TestToRetrySchedule(t *testing.T) {
got := toRetrySchedule([]int{5, 15, 45})
if len(got) != 3 || got[0] != 5*time.Second || got[1] != 15*time.Second || got[2] != 45*time.Second {
t.Fatalf("toRetrySchedule() = %v, want [5s 15s 45s]", got)
}
}
func TestApp_TicketStore(t *testing.T) {
cfg := minimalHTTPConfig()
cfg.Webhook.Secret = "test-secret"