diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-05 14:24:23 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-05 14:24:23 +0300 |
| commit | 7bc3b65b3c66c7744e1c6d4fa69842985d06d9b7 (patch) | |
| tree | fa395b13fde18ba42bf7d5b28ad9d630cfa287cc /cmd | |
| parent | ed208d7120b6e6a7c2ce234504228b5a1ba48f11 (diff) | |
Fix podcast support critical bugs from code review
- Fix boolean scanning from SQLite INTEGER columns (intToBool helper)
- Fix BrowseSet LIMIT 0 returning zero episodes (use 1000 instead)
- Fix checkFeed double-fetch by parsing from resp.Body directly
+ Add ParseFeedReader for body reuse
- Fix file handle leak in DownloadEpisode (explicit Close before ImportMediaFile)
- Fix incomplete rollback in DownloadEpisode (remove file + delete media row)
- Fix 204 No Content handler writing 'null' body
- Fix DownloadCoverImage to accept *http.Client with timeout
- Deduplicate uniqueFilename into shared internal/service/filename.go
- Wire frontend renderPodcastEpisodes into renderBrowse from API data
- Refactor podcasts.js: remove extra API call, fix toggle toast, remove duplicate toast
- Add Config.PodcastCheckMinutes + PODCAST_CHECK_INTERVAL_MINUTES env var
- Start background CheckFeeds goroutine in main.go with ticker
- Update NewPodcastService to accept checkInterval parameter
- Log errors from CheckFeeds and episode creation instead of silently discarding
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/player/main.go | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/cmd/player/main.go b/cmd/player/main.go index b0fec6c..0a7bacb 100644 --- a/cmd/player/main.go +++ b/cmd/player/main.go @@ -95,11 +95,27 @@ func wireDeps(cfg *internal.Config, store repository.Store, logger *slog.Logger, authSvc := service.NewAuthService(store, clk, hasher, sm) helper := service.NewAccessHelper(store) - podcastSvc := service.NewPodcastService(store, clk, cfg.MediaRoot, helper, prober, thumbGen) + podcastSvc := service.NewPodcastService(store, clk, cfg.MediaRoot, helper, prober, thumbGen, cfg.PodcastCheckMinutes) gcWorker := service.NewGCWorker(store, clk, cfg.MediaRoot, time.Duration(cfg.GCIntervalMinutes)*time.Minute, logger) gcWorker.Start() + // Start podcast feed background checker. + go func() { + ticker := time.NewTicker(time.Duration(cfg.PodcastCheckMinutes) * time.Minute) + defer ticker.Stop() + for { + select { + case <-ticker.C: + if err := podcastSvc.CheckFeeds(context.Background()); err != nil { + logger.Error("podcast feed check failed", "err", err) + } + case <-appCtx.Done(): + return + } + } + }() + return &appDeps{ store: store, hasher: hasher, |
