fix(worker): 限制大图归一化峰值内存

6K 多参考图在 P24 下会并发进入高内存缩放并击穿 2 GiB Worker。新增独立可配置的图片归一化并发,生产默认 2,只约束解码、缩放和重编码阶段,不占用视频上游等待槽;缩放器改为内存稳定的近似双线性实现。\n\n验证:6K 到 6000x2400 转换、信号量串行化、Go 全量测试、gofmt、Kubernetes 客户端 dry-run。
This commit is contained in:
2026-07-31 20:54:11 +08:00
parent f190af00be
commit 29533537ec
7 changed files with 127 additions and 9 deletions
+9
View File
@@ -270,6 +270,15 @@ func TestValidateProcessRoleAndDatabasePool(t *testing.T) {
if got := Load().MediaRequestConcurrency; got != 96 {
t.Fatalf("media request concurrency = %d, want 96", got)
}
cfg = Load()
cfg.MediaImageNormalizationConcurrency = 65
if err := cfg.Validate(); err == nil || !strings.Contains(err.Error(), "MEDIA_IMAGE_NORMALIZATION_CONCURRENCY") {
t.Fatalf("Validate() error = %v, want invalid image normalization concurrency", err)
}
t.Setenv("AI_GATEWAY_MEDIA_IMAGE_NORMALIZATION_CONCURRENCY", "3")
if got := Load().MediaImageNormalizationConcurrency; got != 3 {
t.Fatalf("image normalization concurrency = %d, want 3", got)
}
}
func TestValidateTaskHistorySettings(t *testing.T) {