[bugfix] filer: 1. Delete uploaded chunks when upload failed. 2. Report error when upload is interrupted by user.

This commit is contained in:
banjiaojuhao
2022-03-10 11:40:39 +08:00
parent e2b07737da
commit f28dbbe5c5

View File

@@ -79,6 +79,7 @@ func (fs *FilerServer) uploadReaderToChunks(w http.ResponseWriter, r *http.Reque
bufPool.Put(bytesBuffer) bufPool.Put(bytesBuffer)
atomic.AddInt64(&bytesBufferCounter, -1) atomic.AddInt64(&bytesBufferCounter, -1)
bytesBufferLimitCond.Signal() bytesBufferLimitCond.Signal()
uploadErr = err
break break
} }
if chunkOffset == 0 && !isAppend { if chunkOffset == 0 && !isAppend {
@@ -126,6 +127,7 @@ func (fs *FilerServer) uploadReaderToChunks(w http.ResponseWriter, r *http.Reque
wg.Wait() wg.Wait()
if uploadErr != nil { if uploadErr != nil {
fs.filer.DeleteChunks(fileChunks)
return nil, md5Hash, 0, uploadErr, nil return nil, md5Hash, 0, uploadErr, nil
} }