dm/cs
1
0
forked from sm/cs

speed things up (silence is golden)

This commit is contained in:
Stephen McQuay 2016-11-15 21:02:03 -08:00
parent 5e10c8f583
commit 8d0ecfdc7f
No known key found for this signature in database
GPG Key ID: 1ABF428F71BAFC3D

View File

@ -94,7 +94,7 @@ func check(files []string) chan error {
results := []<-chan error{}
workers := 8
workers := 32
for w := 0; w < workers; w++ {
results = append(results, compute(jobs))
}
@ -140,12 +140,11 @@ func compute(jobs chan work) chan error {
continue
}
if _, err := io.Copy(job.cs.hash, f); err != nil {
log.Printf("%+v", err)
r <- err
continue
}
f.Close()
if fmt.Sprintf("%x", job.cs.hash.Sum(nil)) == job.cs.checksum {
fmt.Printf("%s: OK\n", job.cs.filename)
} else {
if fmt.Sprintf("%x", job.cs.hash.Sum(nil)) != job.cs.checksum {
r <- fmt.Errorf("%s: bad", job.cs.filename)
}
}