don't start purge job if podcast-purge-age-days not set

Co-authored-by: Alex McGrath <amk@amk.ie>
This commit is contained in:
sentriz
2023-09-27 13:51:23 +01:00
parent f119659acf
commit 51cf57400e

View File

@@ -301,16 +301,18 @@ func main() {
return nil
}, noCleanup)
g.Add(func() error {
log.Printf("starting job 'podcast purger'\n")
ticker := time.NewTicker(24 * time.Hour)
for range ticker.C {
if err := podcast.PurgeOldPodcasts(time.Duration(*confPodcastPurgeAgeDays) * 24 * time.Hour); err != nil {
log.Printf("error purging old podcasts: %v", err)
if *confPodcastPurgeAgeDays > 0 {
g.Add(func() error {
log.Printf("starting job 'podcast purger'\n")
ticker := time.NewTicker(24 * time.Hour)
for range ticker.C {
if err := podcast.PurgeOldPodcasts(time.Duration(*confPodcastPurgeAgeDays) * 24 * time.Hour); err != nil {
log.Printf("error purging old podcasts: %v", err)
}
}
}
return nil
}, noCleanup)
return nil
}, noCleanup)
}
if *confScanIntervalMins > 0 {
g.Add(func() error {