From 9498e60d285cef437aa7e307c8af0072b62906fd Mon Sep 17 00:00:00 2001 From: Steven Selph Date: Wed, 3 Feb 2016 00:25:20 -0500 Subject: [PATCH] switch to 1MB buffer and fix panic mentioned in #65 --- ds/hasher.go | 2 +- rom/rom.go | 2 +- scraper.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ds/hasher.go b/ds/hasher.go index 4122184..0b82e7c 100644 --- a/ds/hasher.go +++ b/ds/hasher.go @@ -80,7 +80,7 @@ func NewHasher(hashFunc func() hash.Hash, threads int) (*Hasher, error) { l := make(map[string]*sync.Mutex) b := make(chan []byte, threads) for i := 0; i < threads; i++ { - b <- make([]byte, 4*1024*1024) + b <- make([]byte, 1*1024*1024) } return &Hasher{h: hashFunc, c: c, cl: &sync.Mutex{}, l: l, b: b}, nil } diff --git a/rom/rom.go b/rom/rom.go index 22f946b..6c2bfc5 100644 --- a/rom/rom.go +++ b/rom/rom.go @@ -231,7 +231,7 @@ Loop: game.Overview = strings.Map(stripChars, game.Overview) game.GameTitle = strings.Map(stripChars, game.GameTitle) } - if opts.OverviewLen != 0 && opts.OverviewLen > 0 && len(game.Overview) > opts.OverviewLen + 3 { + if opts.OverviewLen != 0 && opts.OverviewLen > 0 && len(game.Overview) > opts.OverviewLen+3 { game.Overview = game.Overview[:opts.OverviewLen] + "..." } r.Game = game diff --git a/scraper.go b/scraper.go index af81c8d..00c51fb 100644 --- a/scraper.go +++ b/scraper.go @@ -522,11 +522,11 @@ func main() { } if *mame || *scrapeAll { mds, err := ds.NewMAME("") - defer mds.Close() if err != nil { fmt.Println(err) return } + defer mds.Close() arcadeSources = append(arcadeSources, mds) } var hasher *ds.Hasher