Skip to content

feat: Ability to re-include older episodes when max_age is increased#872

Open
mm503 wants to merge 1 commit into
mxpv:mainfrom
mm503:fix/support_expand_max_age
Open

feat: Ability to re-include older episodes when max_age is increased#872
mm503 wants to merge 1 commit into
mxpv:mainfrom
mm503:fix/support_expand_max_age

Conversation

@mm503

@mm503 mm503 commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Hey @mxpv, I have a bit controversial PR for you. On several occasions, I needed to raise the max_age setting for a channel to go farther in history, and as you probably know, there is a design limitation that makes it a bit hard.

Increasing a feed's max_age now pulls in older episodes that were previously out of range, instead of silently ignoring them. This required decoupling discovery depth from page_size and making episode re-inclusion work off the database rather than the API window to save API credits.

Changes:

  • Discovery depth is driven by max_age: a normal update still does a shallow scan (page_size most-recent episodes), but when max_age is expanded beyond what was previously scanned, the YouTube builder performs a one-time deep scan that pages back to the max_age cutoff. A per-feed ScannedThrough high-water mark gates this so it costs nothing in steady state, and it is bounded by a 20-page backstop. Brand-new feeds stay shallow.
  • Previously cleaned (soft-deleted) episodes that match the filters again are re-queued for download off the database records directly, independent of the page_size API window. Only episodes that would survive the keep_last cleanup are re-queued, to avoid a re-download/re-clean loop.
  • Cleanup no longer clears an episode's title/description when soft-deleting it, so a re-included episode keeps its metadata. For episodes cleaned by older versions (which wiped metadata), the title/description are recovered from the current feed query.
  • The feed build skips a downloaded episode with an empty title instead of aborting the whole feed, so one malformed item can no longer take down the entire feed.
  • A startup warning is logged when clean.keep_last exceeds page_size and no max_age is configured.
  • Currently implemented for YouTube.

It was a bit of a journey where I went through damaging some DB records on my side all the way to repairing them and having a behavior that doesn't shred through API credits unnecessarily.

@mm503 mm503 force-pushed the fix/support_expand_max_age branch 2 times, most recently from 6094c01 to f34a9b9 Compare June 14, 2026 18:01
Increasing a feed's max_age now pulls in older episodes that were previously out of range, instead of silently
ignoring them. This required decoupling discovery depth from page_size and making episode re-inclusion work off
the database rather than the API window.

- Discovery depth is driven by max_age: a normal update still does a shallow scan (page_size most-recent
  episodes), but when max_age is expanded beyond what was previously scanned, the YouTube builder performs a
  one-time deep scan that pages back to the max_age cutoff. A per-feed ScannedThrough high-water mark gates this
  so it costs nothing in steady state, and it is bounded by a 20-page backstop. Brand-new feeds stay shallow.
- Previously cleaned (soft-deleted) episodes that match the filters again are re-queued for download off the
  database records directly, independent of the page_size API window. Only episodes that would survive the
  keep_last cleanup are re-queued, to avoid a re-download/re-clean loop.
- Cleanup no longer clears an episode's title/description when soft-deleting it, so a re-included episode keeps
  its metadata. For episodes cleaned by older versions (which wiped metadata), the title/description are
  recovered from the current feed query.
- The feed build skips a downloaded episode with an empty title instead of aborting the whole feed, so one
  malformed item can no longer take down the entire feed.
- A startup warning is logged when clean.keep_last exceeds page_size and no max_age is configured.

Currently implemented for YouTube.
@mm503 mm503 force-pushed the fix/support_expand_max_age branch from f34a9b9 to 6d5c2e5 Compare June 14, 2026 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant