also close current pack when time-based flushing happens

This commit is contained in:
Jarek Kowalski
2017-09-10 12:22:28 -07:00
parent 4cfa1d5706
commit 207dff1b9f

View File

@@ -18,7 +18,7 @@
"github.com/kopia/kopia/blob"
)
const flushPackIndexTimeout = 10 * time.Minute
const flushPackIndexTimeout = 10 * time.Second
const packObjectPrefix = "P"
type packInfo struct {
@@ -133,7 +133,12 @@ func (p *packManager) AddToPack(packGroup string, blockID string, data []byte) (
}
if time.Now().After(p.flushPackIndexesAfter) {
p.flushPackIndexesLocked()
if err := p.finishCurrentPackLocked(); err != nil {
return NullObjectID, err
}
if err := p.flushPackIndexesLocked(); err != nil {
return NullObjectID, err
}
}
p.blockToIndex[blockID] = g.currentPackIndex