Skip to content

Commit 635b4bd

Browse files
committed
Change cache expiration
1 parent 4d4f189 commit 635b4bd

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

app/models/concerns/podcast_metrics.rb

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,6 @@ def published_seasons
5656
episodes.published.dropdate_desc.pluck(:season_number).uniq.compact
5757
end
5858

59-
def latest_season
60-
published_seasons.first
61-
end
62-
6359
def season_download_rollups
6460
published_seasons.map do |season|
6561
downloads_by_season(season_number: season).to_a.flatten.presence
@@ -79,9 +75,7 @@ def downloads_by_season(season_number:)
7975
season_episodes_guids = episodes.published.where(season_number: season_number).pluck(:guid)
8076
return default if season_episodes_guids.blank?
8177

82-
expiration = (season_number == latest_season) ? 1.hour : 1.month
83-
84-
results = metrics_cache_fetch("#{metrics_cache_key}/downloads_by_season/#{season_number}", expires_in: expiration) do
78+
results = metrics_cache_fetch("#{metrics_cache_key}/downloads_by_season/#{season_number}", expires_in: 1.hour) do
8579
Rollups::HourlyDownload
8680
.where(podcast_id: id)
8781
.where(episode_id: season_episodes_guids)

0 commit comments

Comments
 (0)