Skip to content

Commit 87dd568

Browse files
authored
Add http_timeout flag to hammer (#673)
1 parent 7773276 commit 87dd568

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

internal/hammer/hammer.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,16 @@ var (
6868
bearerToken = flag.String("bearer_token", "", "The bearer token for auth. For GCP this is the result of `gcloud auth print-access-token`")
6969
bearerTokenWrite = flag.String("bearer_token_write", "", "The bearer token for auth to write. For GCP this is the result of `gcloud auth print-identity-token`. If unset will default to --bearer_token.")
7070

71-
forceHTTP2 = flag.Bool("force_http2", false, "Use HTTP/2 connections *only*")
71+
httpTimeout = flag.Duration("http_timeout", 30*time.Second, "Timeout for HTTP requests")
72+
forceHTTP2 = flag.Bool("force_http2", false, "Use HTTP/2 connections *only*")
7273

7374
hc = &http.Client{
7475
Transport: &http.Transport{
7576
MaxIdleConns: 256,
7677
MaxIdleConnsPerHost: 256,
7778
DisableKeepAlives: false,
7879
},
79-
Timeout: 30 * time.Second,
80+
Timeout: *httpTimeout,
8081
}
8182
)
8283

0 commit comments

Comments
 (0)