mirror of
https://github.com/rclone/rclone.git
synced 2024-12-01 21:04:56 +01:00
refactor code
This commit is contained in:
parent
ca324b5084
commit
940d88b695
@ -1155,16 +1155,8 @@ func (o *Object) updateChunks(in0 io.Reader, headers swift.Headers, size int64,
|
|||||||
return shouldRetryHeaders(rxHeaders, err)
|
return shouldRetryHeaders(rxHeaders, err)
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if len(segmentInfos) > 0 {
|
deleteChunks(o, segmentInfos)
|
||||||
for _, v := range segmentInfos {
|
|
||||||
fs.Debugf(o, "Delete segment file %q on %q", v, o.fs.segmentsContainer)
|
|
||||||
e := o.fs.c.ObjectDelete(o.fs.segmentsContainer, v)
|
|
||||||
if e != nil {
|
|
||||||
fs.Errorf(o, "Error occured in delete segment file %q on %q , error: %q", v, o.fs.segmentsContainer, e)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
segmentInfos = nil
|
segmentInfos = nil
|
||||||
}
|
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
i++
|
i++
|
||||||
@ -1180,6 +1172,13 @@ func (o *Object) updateChunks(in0 io.Reader, headers swift.Headers, size int64,
|
|||||||
return shouldRetryHeaders(rxHeaders, err)
|
return shouldRetryHeaders(rxHeaders, err)
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
deleteChunks(o, segmentInfos)
|
||||||
|
segmentInfos = nil
|
||||||
|
}
|
||||||
|
return uniquePrefix + "/", err
|
||||||
|
}
|
||||||
|
|
||||||
|
func deleteChunks(o *Object, segmentInfos []string) {
|
||||||
if segmentInfos != nil && len(segmentInfos) > 0 {
|
if segmentInfos != nil && len(segmentInfos) > 0 {
|
||||||
for _, v := range segmentInfos {
|
for _, v := range segmentInfos {
|
||||||
fs.Debugf(o, "Delete segment file %q on %q", v, o.fs.segmentsContainer)
|
fs.Debugf(o, "Delete segment file %q on %q", v, o.fs.segmentsContainer)
|
||||||
@ -1188,11 +1187,8 @@ func (o *Object) updateChunks(in0 io.Reader, headers swift.Headers, size int64,
|
|||||||
fs.Errorf(o, "Error occured in delete segment file %q on %q , error: %q", v, o.fs.segmentsContainer, e)
|
fs.Errorf(o, "Error occured in delete segment file %q on %q , error: %q", v, o.fs.segmentsContainer, e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
segmentInfos = nil
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return uniquePrefix + "/", err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update the object with the contents of the io.Reader, modTime and size
|
// Update the object with the contents of the io.Reader, modTime and size
|
||||||
//
|
//
|
||||||
|
Loading…
Reference in New Issue
Block a user