fix(runner): 延长媒体上游请求超时

图像生成上游同步响应可能超过 120 秒,原共享 HTTP 客户端会把仍在处理的提交标记为结果不确定。将客户端超时调整为 10 分钟,并增加回归测试;任务执行仍由现有租约、任务超时和取消机制约束。\n\n验证:\n- env -u AI_GATEWAY_TEST_DATABASE_URL go test ./internal/runner -run 'TestProviderHTTPClientTimeoutAllowsLongRunningMediaRequests|TestPlatformProxyMode' -count=1\n- env -u AI_GATEWAY_TEST_DATABASE_URL go test ./... -count=1
This commit is contained in:
2026-07-24 13:42:47 +08:00
parent 6c5daf29ca
commit 20945dbbcb
2 changed files with 11 additions and 1 deletions
+3 -1
View File
@@ -19,6 +19,8 @@ type httpClientCache struct {
custom map[string]*http.Client
}
const providerHTTPClientTimeout = 10 * time.Minute
func newHTTPClientCache() *httpClientCache {
return &httpClientCache{
none: newHTTPClient(nil),
@@ -67,7 +69,7 @@ func newHTTPClient(proxy func(*http.Request) (*url.URL, error)) *http.Client {
transport := http.DefaultTransport.(*http.Transport).Clone()
transport.Proxy = proxy
return &http.Client{
Timeout: 120 * time.Second,
Timeout: providerHTTPClientTimeout,
Transport: transport,
}
}