Add Dry Run option to clean task (#1081)

This commit is contained in:
bnkai
2021-01-29 06:03:34 +02:00
committed by GitHub
parent 203fc3e4b2
commit df8675c2e7
9 changed files with 60 additions and 21 deletions

View File

@@ -783,7 +783,7 @@ func (s *singleton) autoTagTags(tagIds []string) {
}
}
func (s *singleton) Clean() {
func (s *singleton) Clean(input models.CleanMetadataInput) {
if s.Status.Status != Idle {
return
}
@@ -803,8 +803,13 @@ func (s *singleton) Clean() {
gqb := r.Gallery()
logger.Infof("Starting cleaning of tracked files")
if input.DryRun {
logger.Infof("Running in Dry Mode")
}
var err error
scenes, err = qb.All()
if err != nil {
return errors.New("failed to fetch list of scenes for cleaning")
}
@@ -853,7 +858,7 @@ func (s *singleton) Clean() {
Scene: scene,
fileNamingAlgorithm: fileNamingAlgo,
}
go task.Start(&wg)
go task.Start(&wg, input.DryRun)
wg.Wait()
}
@@ -875,7 +880,7 @@ func (s *singleton) Clean() {
TxnManager: s.TxnManager,
Image: img,
}
go task.Start(&wg)
go task.Start(&wg, input.DryRun)
wg.Wait()
}
@@ -897,7 +902,7 @@ func (s *singleton) Clean() {
TxnManager: s.TxnManager,
Gallery: gallery,
}
go task.Start(&wg)
go task.Start(&wg, input.DryRun)
wg.Wait()
}