mirror of
https://github.com/rclone/rclone.git
synced 2024-11-23 00:43:49 +01:00
cache: try a full read on the last chunk for #1896
This commit is contained in:
parent
7c972d375b
commit
829dd1ad25
16
cache/handle.go
vendored
16
cache/handle.go
vendored
@ -427,9 +427,10 @@ func (w *worker) run() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
chunkEnd := chunkStart + w.r.cacheFs().chunkSize
|
chunkEnd := chunkStart + w.r.cacheFs().chunkSize
|
||||||
if chunkEnd > w.r.cachedObject.Size() {
|
// TODO: Remove this comment if it proves to be reliable for #1896
|
||||||
chunkEnd = w.r.cachedObject.Size()
|
//if chunkEnd > w.r.cachedObject.Size() {
|
||||||
}
|
// chunkEnd = w.r.cachedObject.Size()
|
||||||
|
//}
|
||||||
|
|
||||||
w.download(chunkStart, chunkEnd, 0)
|
w.download(chunkStart, chunkEnd, 0)
|
||||||
}
|
}
|
||||||
@ -464,11 +465,12 @@ func (w *worker) download(chunkStart, chunkEnd int64, retry int) {
|
|||||||
w.download(chunkStart, chunkEnd, retry+1)
|
w.download(chunkStart, chunkEnd, retry+1)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if err == io.ErrUnexpectedEOF {
|
|
||||||
fs.Debugf(w, "partial read chunk %v: %v", chunkStart, err)
|
|
||||||
}
|
|
||||||
data = data[:sourceRead] // reslice to remove extra garbage
|
data = data[:sourceRead] // reslice to remove extra garbage
|
||||||
fs.Debugf(w, "downloaded chunk %v", fs.SizeSuffix(chunkStart))
|
if err == io.ErrUnexpectedEOF {
|
||||||
|
fs.Debugf(w, "partial downloaded chunk %v", fs.SizeSuffix(chunkStart))
|
||||||
|
} else {
|
||||||
|
fs.Debugf(w, "downloaded chunk %v", fs.SizeSuffix(chunkStart))
|
||||||
|
}
|
||||||
|
|
||||||
if w.r.UseMemory {
|
if w.r.UseMemory {
|
||||||
err = w.r.memory.AddChunk(w.r.cachedObject.abs(), data, chunkStart)
|
err = w.r.memory.AddChunk(w.r.cachedObject.abs(), data, chunkStart)
|
||||||
|
Loading…
Reference in New Issue
Block a user