Skip to content

Commit f34cd2e

Browse files
authored
fix(podcast): slightly more robust downloading and concurrency (#433)
1 parent 2f109f1 commit f34cd2e

File tree

4 files changed

+201
-220
lines changed

4 files changed

+201
-220
lines changed

cmd/gonic/gonic.go

+11
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,17 @@ func main() {
388388
return nil
389389
})
390390

391+
errgrp.Go(func() error {
392+
defer logJob("podcast download")()
393+
394+
ctxTick(ctx, 5*time.Second, func() {
395+
if err := podcast.DownloadTick(); err != nil {
396+
log.Printf("failed to download podcast: %s", err)
397+
}
398+
})
399+
return nil
400+
})
401+
391402
errgrp.Go(func() error {
392403
if *confPodcastPurgeAgeDays == 0 {
393404
return nil

db/db.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ func (pe *PodcastEpisode) MIME() string {
527527
}
528528

529529
func (pe *PodcastEpisode) AbsPath() string {
530-
if pe.Podcast == nil {
530+
if pe.Podcast == nil || pe.Podcast.RootDir == "" {
531531
return ""
532532
}
533533
return filepath.Join(pe.Podcast.RootDir, pe.Filename)

0 commit comments

Comments
 (0)