Skip to content

Conversation

@SergioEstevao
Copy link
Contributor

Fixes PCIOS-398

So far episodes info are cached and never reloaded unless the system clears our cache or the user re-install the app. This PR adds the possibility to set a threshold for each podcast to reload the episodes info weekly or monthly.

Podcast Settings Options
IMG_0551 IMG_0552

This is base on this original PR from Daniele: #3792

To test

  • Run this branch and enable reloadEpisodeInfoCachePolicy FF
  • Go to a podcast and open its settings
  • You should see the Settings Episodes Info Refresh Time with the option Never set
  • Tap on it and select Debug
  • This set the debug option to reload the Episodes Info when opening an episode detail if 15 seconds have passed
  • Open the podcast episodes detail
  • After loading the episode info re-open the same episode or a new one
  • Within the 15 seconds you should get the cached version
  • If the threshold is passed you should see the info getting reloaded
  • You can also check the logs to help you understand when the cached is returned or when the API is called

Checklist

  • I have considered if this change warrants user-facing release notes and have added them to CHANGELOG.md if necessary.
  • I have considered adding unit tests for my changes.
  • I have updated (or requested that someone edit) the spreadsheet to reflect any new or changed analytics.

@SergioEstevao SergioEstevao added this to the 8.3 milestone Jan 5, 2026
@SergioEstevao SergioEstevao requested a review from a team as a code owner January 5, 2026 10:48
@SergioEstevao SergioEstevao requested review from bjtitus and removed request for a team January 5, 2026 10:48
@dangermattic
Copy link
Collaborator

1 Warning
⚠️ This PR is assigned to the milestone 8.3. The due date for this milestone has already passed.
Please assign it to a milestone with a later deadline or check whether the release for this milestone has already been finished.

Generated by 🚫 Danger

Comment on lines +188 to +190
/// Returns true if the given date is considered stale based on the podcast's episodesInfoCacheReloadPolicyType.
/// - Parameter date: The date to evaluate. If `nil`, this returns true for policies other than `.never`.
/// - Returns: `true` if the date is older than the threshold for the current policy (week/month), otherwise `false`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not 100% sure what the expected behavior is but this is returning true when the policy is never and date is nil because of the guard. The docs on date make me think it should return false there.

Here's a test exhibiting:

    func testEpisodesInfoCacheStaleNeverPolicyWithNilDateShouldReturnFalse() throws {
        let podcast = Podcast()
        podcast.episodesInfoCacheReloadPolicy = Podcast.EpisodeInfoCacheReloadPolicy.never.rawValue

        let now = ISO8601DateFormatter().date(from: "2024-01-15T12:00:00Z")!

        XCTAssertFalse(
            podcast.isEpisodesInfoCacheStale(since: nil, now: now),
            "When policy is .never and date is nil, should return false according to doc comment"
        )
    }

@pocketcasts pocketcasts modified the milestones: 8.3, 8.4 Jan 5, 2026
@pocketcasts
Copy link
Contributor

Version 8.3 has now entered code-freeze, so the milestone of this PR has been updated to 8.4.

@danielebogo
Copy link
Contributor

@SergioEstevao just a heads up the cache is now invalidated if some changes are detected #3818

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants