Skip to content

Commit

Permalink
don't start purge job if podcast-purge-age-days not set
Browse files Browse the repository at this point in the history
Co-authored-by: Alex McGrath <[email protected]>
  • Loading branch information
sentriz and lxea committed Sep 27, 2023
1 parent f119659 commit 51cf574
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions cmd/gonic/gonic.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 51cf574

Please sign in to comment.