-
Notifications
You must be signed in to change notification settings - Fork 173
Conversation
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 |
|---|---|
This is base on this original PR from Daniele: #3792
To test
- Run this branch and enable
reloadEpisodeInfoCachePolicyFF - Go to a podcast and open its settings
- You should see the Settings
Episodes Info Refresh Timewith the optionNeverset - 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.mdif 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.
| /// 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`. |
There was a problem hiding this comment.
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 testEpisodesInfoCacheStaleNeverPolicyWithNilDateShouldReturn False() 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"
)
}
|
Version |
|
@SergioEstevao just a heads up the cache is now invalidated if some changes are detected #3818 |
|
Version |
|
Version |
|
Version |
|
Version |
|
Version |