Otherwise we bottleneck early on lots of IO that we can't process that
quickly.
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>
variantmap := map[tileLibRef]tileVariantID{}
errs := make(chan error, len(files))
log.Infof("LoadDir: read %d files", len(files))
+ throttle := throttle{Max: runtime.GOMAXPROCS(0)/2 + 1}
for _, path := range files {
path := path
go func() {
+ throttle.Acquire()
+ defer throttle.Release()
f, err := open(path)
if err != nil {
errs <- err