fix: cap CPU and avoid heavy startup work

This commit is contained in:
ShukeBta
2026-06-11 19:48:00 +08:00
parent d9f87c61b6
commit 7274ea19b7
13 changed files with 230 additions and 35 deletions
+10
View File
@@ -30,4 +30,14 @@ func TestApplyRuntimeSettingTranscodeSwitches(t *testing.T) {
if cfg.Transcoder.MaxConcurrent != 1 {
t.Fatalf("max concurrent = %d, want 1", cfg.Transcoder.MaxConcurrent)
}
ApplyRuntimeSetting(cfg, "app.max_cpu_threads", "99")
if cfg.App.MaxCPUThreads != 8 {
t.Fatalf("max cpu threads = %d, want clamp 8", cfg.App.MaxCPUThreads)
}
ApplyRuntimeSetting(cfg, "app.max_cpu_threads", "0")
if cfg.App.MaxCPUThreads != 1 {
t.Fatalf("max cpu threads = %d, want clamp 1", cfg.App.MaxCPUThreads)
}
}