1
0
Fork 0
mirror of https://github.com/restic/restic.git synced 2024-12-23 08:16:36 +00:00

restore: avoid long cancelation delay for frequently used blobs

This commit is contained in:
Michael Eischer 2024-07-12 22:29:56 +02:00
parent f64191da9c
commit c77b2d5ca2

View file

@ -327,6 +327,11 @@ func (r *fileRestorer) downloadBlobs(ctx context.Context, packID restic.ID,
} }
for file, offsets := range blob.files { for file, offsets := range blob.files {
for _, offset := range offsets { for _, offset := range offsets {
// avoid long cancelation delays for frequently used blobs
if ctx.Err() != nil {
return ctx.Err()
}
writeToFile := func() error { writeToFile := func() error {
// this looks overly complicated and needs explanation // this looks overly complicated and needs explanation
// two competing requirements: // two competing requirements: