Reorder waitgroup completion (#1748)

Rather than passing a pointer to a waitgroup into task.Start(..)
functions, handle the waitgroup.Done() at the callsite.

This makes waitgroup handling local to its definition rather than it
being spread out over multiple files. Tasks now simply execute, and
the policy of waiting on them is handled by the caller.
This commit is contained in:
SmallCoccinelle
2021-09-22 05:22:59 +02:00
committed by GitHub
parent 56111433a1
commit 4a0c4c4847
12 changed files with 43 additions and 71 deletions

View File

@@ -1,8 +1,6 @@
package manager
import (
"github.com/remeh/sizedwaitgroup"
"github.com/stashapp/stash/pkg/ffmpeg"
"github.com/stashapp/stash/pkg/logger"
"github.com/stashapp/stash/pkg/manager/config"
@@ -20,9 +18,7 @@ type GeneratePreviewTask struct {
fileNamingAlgorithm models.HashAlgorithm
}
func (t *GeneratePreviewTask) Start(wg *sizedwaitgroup.SizedWaitGroup) {
defer wg.Done()
func (t *GeneratePreviewTask) Start() {
videoFilename := t.videoFilename()
videoChecksum := t.Scene.GetHash(t.fileNamingAlgorithm)
imageFilename := t.imageFilename()