Merge pull request #368 from Contextualist/fix-cleanup

Clean up episodes before generating XML feed
This commit is contained in:
Maksym Pavlenko
2022-09-14 09:03:31 -07:00
committed by GitHub
2 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -110,7 +110,7 @@ func Build(_ctx context.Context, feed *model.Feed, cfg *Config, hostname string)
for i, episode := range feed.Episodes {
if episode.Status != model.EpisodeDownloaded {
// Skip episodes that are not yet downloaded
// Skip episodes that are not yet downloaded or have been removed
continue
}
+4 -4
View File
@@ -71,6 +71,10 @@ func (u *Manager) Update(ctx context.Context, feedConfig *feed.Config) error {
return errors.Wrap(err, "download failed")
}
if err := u.cleanup(ctx, feedConfig); err != nil {
log.WithError(err).Error("cleanup failed")
}
if err := u.buildXML(ctx, feedConfig); err != nil {
return errors.Wrap(err, "xml build failed")
}
@@ -79,10 +83,6 @@ func (u *Manager) Update(ctx context.Context, feedConfig *feed.Config) error {
return errors.Wrap(err, "opml build failed")
}
if err := u.cleanup(ctx, feedConfig); err != nil {
log.WithError(err).Error("cleanup failed")
}
elapsed := time.Since(started)
log.Infof("successfully updated feed in %s", elapsed)
return nil