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:
@@ -5,11 +5,19 @@ import (
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/easyai/easyai-ai-gateway/apps/api/internal/config"
|
||||
"github.com/easyai/easyai-ai-gateway/apps/api/internal/store"
|
||||
)
|
||||
|
||||
func TestProviderHTTPClientTimeoutAllowsLongRunningMediaRequests(t *testing.T) {
|
||||
client := newHTTPClient(nil)
|
||||
if client.Timeout != 10*time.Minute {
|
||||
t.Fatalf("unexpected provider HTTP timeout: got %s want %s", client.Timeout, 10*time.Minute)
|
||||
}
|
||||
}
|
||||
|
||||
func TestPlatformProxyModeNoneIgnoresEnvironmentProxy(t *testing.T) {
|
||||
var proxyHits int
|
||||
proxy := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
Reference in New Issue
Block a user