Fix rare 'file already closed' during restore

Fixes #2183

Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>
This commit is contained in:
Igor Fedorenko
2019-02-24 21:50:40 -08:00
committed by Alexander Neumann
parent 65b476ead9
commit bf9a507148
4 changed files with 60 additions and 28 deletions

View File

@@ -23,8 +23,8 @@ import (
const (
workerCount = 8
// max number of open output file handles
filesWriterCount = 32
// max number of cached open output file handles
filesWriterCacheCap = 32
// estimated average pack size used to calculate pack cache capacity
averagePackSize = 5 * 1024 * 1024
@@ -73,7 +73,7 @@ func newFileRestorer(dst string, packLoader func(ctx context.Context, h restic.H
packLoader: packLoader,
key: key,
idx: idx,
filesWriter: newFilesWriter(filesWriterCount),
filesWriter: newFilesWriter(filesWriterCacheCap),
packCache: newPackCache(packCacheCapacity),
dst: dst,
}