qingstor: fix go routine leak on multipart upload errors - fixes #2851
This commit is contained in:
parent
39f5059d48
commit
9685be64cd
1 changed files with 8 additions and 0 deletions
|
@ -392,6 +392,14 @@ func (mu *multiUploader) multiPartUpload(firstBuf io.ReadSeeker) error {
|
||||||
var nextChunkLen int
|
var nextChunkLen int
|
||||||
reader, nextChunkLen, err = mu.nextReader()
|
reader, nextChunkLen, err = mu.nextReader()
|
||||||
if err != nil && err != io.EOF {
|
if err != nil && err != io.EOF {
|
||||||
|
// empty ch
|
||||||
|
go func() {
|
||||||
|
for range ch {
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
// Wait for all goroutines finish
|
||||||
|
close(ch)
|
||||||
|
mu.wg.Wait()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if nextChunkLen == 0 && partNumber > 0 {
|
if nextChunkLen == 0 && partNumber > 0 {
|
||||||
|
|
Loading…
Reference in a new issue