replace ad-hoc context.TODO() with gopts.ctx, so that cancellation

can properly trickle down from cmd_*.

gh-1434
This commit is contained in:
George Armhold
2017-11-22 06:27:29 -05:00
parent 63bb1933e5
commit d886cb5c27
18 changed files with 41 additions and 42 deletions

View File

@@ -103,7 +103,7 @@ func (r *Reader) Archive(ctx context.Context, name string, rd io.Reader, p *rest
debug.Log("snapshot saved as %v", id.Str())
err = repo.Flush()
err = repo.Flush(ctx)
if err != nil {
return nil, restic.ID{}, err
}

View File

@@ -764,7 +764,7 @@ func (arch *Archiver) Snapshot(ctx context.Context, p *restic.Progress, paths, t
debug.Log("workers terminated")
// flush repository
err = arch.repo.Flush()
err = arch.repo.Flush(ctx)
if err != nil {
return nil, restic.ID{}, err
}

View File

@@ -144,7 +144,7 @@ func testArchiverDuplication(t *testing.T) {
wg.Wait()
err = repo.Flush()
err = repo.Flush(context.Background())
if err != nil {
t.Fatal(err)
}

View File

@@ -248,7 +248,7 @@ func testParallelSaveWithDuplication(t *testing.T, seed int) {
rtest.OK(t, <-errChan)
}
rtest.OK(t, repo.Flush())
rtest.OK(t, repo.Flush(context.Background()))
rtest.OK(t, repo.SaveIndex(context.TODO()))
chkr := createAndInitChecker(t, repo)