From 79876c5da110c917a377934725a64181f562339a Mon Sep 17 00:00:00 2001 From: Ivan Tivonenko Date: Fri, 19 Feb 2021 10:50:56 +0200 Subject: [PATCH] Fix ParallelReadFiles - increase buffer size of the receiving channel --- drivers/readerpool.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/readerpool.go b/drivers/readerpool.go index 3a6ce8f9e0..7bc6b02344 100644 --- a/drivers/readerpool.go +++ b/drivers/readerpool.go @@ -47,7 +47,7 @@ func readWorker(ctx context.Context, tasks chan *task, resCh chan *readResult) { continue } fi.Body.Close() - glog.V(common.VERBOSE).Infof("Reading file=%s took=%s", task.fileName, time.Since(now)) + glog.V(common.VERBOSE).Infof("Reading file=%s bytes=%d took=%s", task.fileName, len(fb), time.Since(now)) res.data = fb res.fileInfo = fi resCh <- res @@ -61,7 +61,7 @@ func ParallelReadFiles(ctx context.Context, sess OSSession, filesNames []string, if len(filesNames) < workers { workersToStart = len(filesNames) } - resCh := make(chan *readResult, 8) + resCh := make(chan *readResult, len(filesNames)) tasks := make(chan *task) for i := 0; i < workersToStart; i++ { go readWorker(ctx, tasks, resCh)