fix(agent): align Binding file upload timeouts (#41027)

This commit is contained in:
Ingram Z authored and GitHub committed 2026-08-20 18:59:44 +00:00
1 parent 785ca4b915
commit 0ca99312c1
20 files changed
+154 -21

No files matched your search

@@ -25,7 +25,10 @@ type HTTPClient struct {
var errUploadRequestAborted = errors.New("upload request aborted")
const agentStubAuthorizationExpiredCode = "agent_stub_authorization_expired"
const (
agentStubAuthorizationExpiredCode = "agent_stub_authorization_expired"
defaultUploadRequestTimeout = 180 * time.Second
)
type agentStubHTTPError struct {
statusCode int
@@ -70,7 +73,7 @@ func openUploadSource(path string) (io.ReadCloser, error) {
}
func doUploadRequest(req *http.Request) (*http.Response, error) {
return (&http.Client{Timeout: 120 * time.Second}).Do(req)
return (&http.Client{Timeout: defaultUploadRequestTimeout}).Do(req)
}
// postJSON sends a POST request with JSON body and returns the response body.
@@ -20,6 +20,12 @@ import (
const fifoTestDeadline = 3 * time.Second
func TestDefaultUploadRequestTimeout(t *testing.T) {
if defaultUploadRequestTimeout != 180*time.Second {
t.Fatalf("defaultUploadRequestTimeout = %s, want 180s", defaultUploadRequestTimeout)
}
}
func receiveWithin[T any](ch <-chan T, timeout time.Duration) (T, bool) {
timer := time.NewTimer(timeout)
defer timer.Stop()