From a0fea201d97507ea3d45e735c02d784278aa4aae Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Wed, 18 Feb 2015 23:10:59 +0100 Subject: [PATCH] Reenable Preloading --- archiver.go | 2 +- cmd/restic/cmd_backup.go | 10 +++++----- server.go | 6 ++---- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/archiver.go b/archiver.go index 91a2f348b..f4d4977f3 100644 --- a/archiver.go +++ b/archiver.go @@ -18,7 +18,7 @@ import ( const ( maxConcurrentBlobs = 32 maxConcurrency = 10 - maxConcurrencyPreload = 100 + maxConcurrencyPreload = 20 // chunkerBufSize is used in pool.go chunkerBufSize = 512 * chunker.KiB diff --git a/cmd/restic/cmd_backup.go b/cmd/restic/cmd_backup.go index 80a7cd07d..50d19daa2 100644 --- a/cmd/restic/cmd_backup.go +++ b/cmd/restic/cmd_backup.go @@ -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 { diff --git a/server.go b/server.go index 5c88fc1a4..07adeec97 100644 --- a/server.go +++ b/server.go @@ -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)