speed things up (silence is golden)
This commit is contained in:
parent
5e10c8f583
commit
8d0ecfdc7f
9
check.go
9
check.go
@ -94,7 +94,7 @@ func check(files []string) chan error {
|
|||||||
|
|
||||||
results := []<-chan error{}
|
results := []<-chan error{}
|
||||||
|
|
||||||
workers := 8
|
workers := 32
|
||||||
for w := 0; w < workers; w++ {
|
for w := 0; w < workers; w++ {
|
||||||
results = append(results, compute(jobs))
|
results = append(results, compute(jobs))
|
||||||
}
|
}
|
||||||
@ -140,12 +140,11 @@ func compute(jobs chan work) chan error {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if _, err := io.Copy(job.cs.hash, f); err != nil {
|
if _, err := io.Copy(job.cs.hash, f); err != nil {
|
||||||
log.Printf("%+v", err)
|
r <- err
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
f.Close()
|
f.Close()
|
||||||
if fmt.Sprintf("%x", job.cs.hash.Sum(nil)) == job.cs.checksum {
|
if fmt.Sprintf("%x", job.cs.hash.Sum(nil)) != job.cs.checksum {
|
||||||
fmt.Printf("%s: OK\n", job.cs.filename)
|
|
||||||
} else {
|
|
||||||
r <- fmt.Errorf("%s: bad", job.cs.filename)
|
r <- fmt.Errorf("%s: bad", job.cs.filename)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user