Reenable Preloading

This commit is contained in:
Alexander Neumann 2015-02-18 23:10:59 +01:00
parent f214dce87c
commit a0fea201d9
3 changed files with 8 additions and 10 deletions

View file

@ -18,7 +18,7 @@ import (
const (
maxConcurrentBlobs = 32
maxConcurrency = 10
maxConcurrencyPreload = 100
maxConcurrencyPreload = 20
// chunkerBufSize is used in pool.go
chunkerBufSize = 512 * chunker.KiB

View file

@ -193,11 +193,11 @@ func (cmd CmdBackup) Execute(args []string) error {
return nil
}
// fmt.Printf("loading blobs\n")
// err = arch.Preload()
// if err != nil {
// return err
// }
fmt.Printf("loading blobs\n")
err = arch.Preload()
if err != nil {
return err
}
_, id, err := arch.Snapshot(target, parentSnapshotID)
if err != nil {

View file

@ -109,14 +109,12 @@ func (s Server) LoadJSON(t backend.Type, blob Blob, item interface{}) error {
}
var (
zEmptyString = []byte("x\x9C\x03\x00\x00\x00\x00\x01")
zEmptyStringReader = bytes.NewReader(zEmptyString)
zEmptyString = []byte("x\x9C\x03\x00\x00\x00\x00\x01")
)
var zReaderPool = sync.Pool{
New: func() interface{} {
zEmptyStringReader.Seek(0, 0)
rd, err := zlib.NewReader(zEmptyStringReader)
rd, err := zlib.NewReader(bytes.NewReader(zEmptyString))
if err != nil {
// shouldn't happen
panic(err)