Skip to content

Commit

Permalink
Disable timeout for downloading files (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
majd authored Dec 7, 2022
1 parent a3b322c commit 2f154ad
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions pkg/appstore/appstore_download.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,12 @@ func (a *appstore) downloadFile(dst, sourceURL string) (err error) {
return errors.Wrap(err, ErrOpenFile.Error())
}

defer func() {
if closeErr := file.Close(); closeErr != err && err == nil {
err = closeErr
}
}()

sizeMB := float64(res.ContentLength) / (1 << 20)
a.logger.Verbose().Str("size", fmt.Sprintf("%.2fMB", sizeMB)).Msg("downloading")

Expand Down
2 changes: 1 addition & 1 deletion pkg/http/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (c *client[R]) Send(req Request) (Result[R], error) {
}

func (c *client[R]) Do(req *http.Request) (*http.Response, error) {
return c.internalClient.Do(req)
return http.DefaultClient.Do(req)
}

func (*client[R]) NewRequest(method, url string, body io.Reader) (*http.Request, error) {
Expand Down

0 comments on commit 2f154ad

Please sign in to comment.