diff --git a/apps/api/internal/runner/proxy.go b/apps/api/internal/runner/proxy.go index f650ada..9f74f10 100644 --- a/apps/api/internal/runner/proxy.go +++ b/apps/api/internal/runner/proxy.go @@ -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, } } diff --git a/apps/api/internal/runner/proxy_test.go b/apps/api/internal/runner/proxy_test.go index ebb8aca..cd6c385 100644 --- a/apps/api/internal/runner/proxy_test.go +++ b/apps/api/internal/runner/proxy_test.go @@ -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) {