From 31887ea9aaaf7a8a4766d48e972ebfd0d50d20dd Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Fri, 12 Jul 2024 22:24:35 +0200 Subject: [PATCH] restore: fix hang on command cancelation --- internal/restorer/filerestorer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/restorer/filerestorer.go b/internal/restorer/filerestorer.go index 56059cb16..d2a4ba068 100644 --- a/internal/restorer/filerestorer.go +++ b/internal/restorer/filerestorer.go @@ -192,6 +192,7 @@ func (r *fileRestorer) restoreFiles(ctx context.Context) error { // the main restore loop wg.Go(func() error { + defer close(downloadCh) for _, id := range packOrder { pack := packs[id] // allow garbage collection of packInfo @@ -203,7 +204,6 @@ func (r *fileRestorer) restoreFiles(ctx context.Context) error { debug.Log("Scheduled download pack %s", pack.id.Str()) } } - close(downloadCh) return nil })