From 42917d707df72631099777d09c61a8fd55313ccc Mon Sep 17 00:00:00 2001 From: greatroar <61184462+greatroar@users.noreply.github.com> Date: Wed, 3 Feb 2021 14:25:24 +0100 Subject: [PATCH] lib/scanner: Remove unused field, move WaitGroup.Add out of loop (#7323) --- lib/scanner/blockqueue.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/scanner/blockqueue.go b/lib/scanner/blockqueue.go index a56187535..6acaa0ea7 100644 --- a/lib/scanner/blockqueue.go +++ b/lib/scanner/blockqueue.go @@ -63,7 +63,6 @@ func HashFile(ctx context.Context, fs fs.Filesystem, path string, blockSize int, // is closed and all items handled. type parallelHasher struct { fs fs.Filesystem - workers int outbox chan<- ScanResult inbox <-chan protocol.FileInfo counter Counter @@ -74,7 +73,6 @@ type parallelHasher struct { func newParallelHasher(ctx context.Context, fs fs.Filesystem, workers int, outbox chan<- ScanResult, inbox <-chan protocol.FileInfo, counter Counter, done chan<- struct{}) { ph := ¶llelHasher{ fs: fs, - workers: workers, outbox: outbox, inbox: inbox, counter: counter, @@ -82,8 +80,8 @@ func newParallelHasher(ctx context.Context, fs fs.Filesystem, workers int, outbo wg: sync.NewWaitGroup(), } + ph.wg.Add(workers) for i := 0; i < workers; i++ { - ph.wg.Add(1) go ph.hashFiles(ctx) }