refactor: introduce GC, to delete old data

This commit is contained in:
Deluan
2020-01-31 20:17:36 -05:00
committed by Deluan Quintão
parent 5d1df19291
commit de1fea64bc
6 changed files with 105 additions and 9 deletions
+3 -9
View File
@@ -104,17 +104,11 @@ func (s *TagScanner) Scan(ctx context.Context, lastModifiedSince time.Time) erro
return err
}
err = s.ds.Album(ctx).PurgeEmpty()
if err != nil {
return err
if len(changed)+len(deleted) == 0 {
return nil
}
err = s.ds.Artist(ctx).PurgeEmpty()
if err != nil {
return err
}
return nil
return s.ds.GC(log.NewContext(nil))
}
func (s *TagScanner) refreshAlbums(ctx context.Context, updatedAlbums map[string]bool) error {