Skip to content

Commit

Permalink
outofband/download: define HTTP client timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
joelrebel committed May 4, 2023
1 parent aebef61 commit f3f8814
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/outofband/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import (
)

var (
downloadRetryDelay = 4 * time.Second
downloadRetryDelay = 4 * time.Second
downloadClientTimeout = 60 * time.Second

ErrDownload = errors.New("error downloading file")
ErrChecksum = errors.New("error validating file checksum")
Expand Down Expand Up @@ -44,6 +45,7 @@ func download(ctx context.Context, fileURL, dst string) error {
client := retryablehttp.NewClient()
client.RetryWaitMin = downloadRetryDelay
client.Logger = nil
client.HTTPClient.Timeout = downloadClientTimeout

resp, err := client.Do(requestRetryable)
if err != nil {
Expand All @@ -57,6 +59,7 @@ func download(ctx context.Context, fileURL, dst string) error {
}

_, err = io.Copy(fileHandle, resp.Body)

return err
}

Expand Down

0 comments on commit f3f8814

Please sign in to comment.