Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #2368, which causes system lacked sufficient buffer space #2372

Merged
merged 2 commits into from
Aug 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions internal/download/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ func (r Request) Bytes() ([]byte, error) {
return nil, err
}
defer rd.Close()
defer r.client().CloseIdleConnections()
return io.ReadAll(rd)
}

Expand All @@ -147,6 +148,7 @@ func (r Request) JSON() (gjson.Result, error) {
return gjson.Result{}, err
}
defer rd.Close()
defer r.client().CloseIdleConnections()

var sb strings.Builder
_, err = io.Copy(&sb, rd)
Expand Down Expand Up @@ -174,6 +176,7 @@ func (r Request) WriteToFile(path string) error {
return err
}
defer rd.Close()
defer r.client().CloseIdleConnections()
return writeToFile(rd, path)
}

Expand All @@ -183,6 +186,7 @@ func (r Request) WriteToFileMultiThreading(path string, thread int) error {
return r.WriteToFile(path)
}

defer r.client().CloseIdleConnections()
limit := r.Limit
type BlockMetaData struct {
BeginOffset int64
Expand Down
Loading