archiver: Add test for early abort on unhandled error

This commit is contained in:
Alexander Neumann 2018-05-12 23:08:00 +02:00
parent 526956af35
commit c5e75d1c98
3 changed files with 143 additions and 0 deletions

View file

@ -117,10 +117,12 @@ func (s *FileSaver) Save(ctx context.Context, snPath string, file fs.File, fi os
case s.ch <- job:
case <-s.done:
debug.Log("not sending job, FileSaver is done")
_ = file.Close()
close(ch)
return FutureFile{ch: ch}
case <-ctx.Done():
debug.Log("not sending job, context is cancelled: %v", ctx.Err())
_ = file.Close()
close(ch)
return FutureFile{ch: ch}
}