Skip to content

Commit

Permalink
fix(podcast): slightly more robust downloading and concurrency (#433)
Browse files Browse the repository at this point in the history
  • Loading branch information
sentriz committed Dec 21, 2023
1 parent 2f109f1 commit f34cd2e
Show file tree
Hide file tree
Showing 4 changed files with 201 additions and 220 deletions.
11 changes: 11 additions & 0 deletions cmd/gonic/gonic.go
Expand Up @@ -388,6 +388,17 @@ func main() {
return nil
})

errgrp.Go(func() error {
defer logJob("podcast download")()

ctxTick(ctx, 5*time.Second, func() {
if err := podcast.DownloadTick(); err != nil {
log.Printf("failed to download podcast: %s", err)
}
})
return nil
})

errgrp.Go(func() error {
if *confPodcastPurgeAgeDays == 0 {
return nil
Expand Down
2 changes: 1 addition & 1 deletion db/db.go
Expand Up @@ -527,7 +527,7 @@ func (pe *PodcastEpisode) MIME() string {
}

func (pe *PodcastEpisode) AbsPath() string {
if pe.Podcast == nil {
if pe.Podcast == nil || pe.Podcast.RootDir == "" {
return ""
}
return filepath.Join(pe.Podcast.RootDir, pe.Filename)
Expand Down

0 comments on commit f34cd2e

Please sign in to comment.