mirror of
https://github.com/restic/restic.git
synced 2025-08-24 22:17:30 +00:00
archiver: Improve error handling
This commit changes how the worker goroutines for saving e.g. blobs interact. Before, it was possible to get stuck sending an instruction to archive a file or dir when no worker goroutines were available any more. This commit introduces a `done` channel for each of the worker pools, which is set to the channel returned by `tomb.Dying()`, so it is closed when the first worker returned an error.
This commit is contained in:
@@ -70,6 +70,8 @@ func saveFile(t testing.TB, repo restic.Repository, filename string, filesystem
|
||||
}
|
||||
|
||||
res := arch.fileSaver.Save(ctx, "/", file, fi, start, complete)
|
||||
|
||||
res.Wait(ctx)
|
||||
if res.Err() != nil {
|
||||
t.Fatal(res.Err())
|
||||
}
|
||||
@@ -620,6 +622,7 @@ func TestArchiverSaveDir(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
ft.Wait(ctx)
|
||||
node, stats := ft.Node(), ft.Stats()
|
||||
|
||||
tmb.Kill(nil)
|
||||
@@ -701,6 +704,7 @@ func TestArchiverSaveDirIncremental(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
ft.Wait(ctx)
|
||||
node, stats := ft.Node(), ft.Stats()
|
||||
|
||||
tmb.Kill(nil)
|
||||
|
Reference in New Issue
Block a user