From d262c12b43d41eb1ba825509bdd54baee6be83f3 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Thu, 16 Jul 2020 21:53:05 -0700 Subject: [PATCH] Less confusing waitgroup positioning --- server/filesystem_walker.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/server/filesystem_walker.go b/server/filesystem_walker.go index bb3bf6b..0c51c07 100644 --- a/server/filesystem_walker.go +++ b/server/filesystem_walker.go @@ -41,8 +41,6 @@ func newPooledWalker(fs *Filesystem) *PooledFileWalker { // Process a given path by calling the callback function for all of the files and directories within // the path, and then dropping into any directories that we come across. func (w *PooledFileWalker) process(path string) error { - defer w.wg.Done() - p, err := w.Filesystem.SafePath(path) if err != nil { return err @@ -82,6 +80,7 @@ func (w *PooledFileWalker) process(path string) error { func (w *PooledFileWalker) push(path string) { w.wg.Add(1) w.pool.Submit(func() { + defer w.wg.Done() w.process(path) }) }