Skip to content

Improve football match-header and match info cache time#28692

Open
marjisound wants to merge 3 commits intomainfrom
reduce-match-header-cache-time-before-match-starts
Open

Improve football match-header and match info cache time#28692
marjisound wants to merge 3 commits intomainfrom
reduce-match-header-cache-time-before-match-starts

Conversation

@marjisound
Copy link
Copy Markdown
Contributor

@marjisound marjisound commented Mar 30, 2026

What does this change?

The /football/api/match-header endpoint currently uses a cache duration of 10 seconds when a match is live, and 300 seconds (5 minutes) otherwise.

This can cause an issue around kickoff time: when a match transitions to live, responses may still be served from the 5-minute cache, delaying the update to the live state.

This PR addresses the issue by reducing the cache duration in the 5 minutes leading up to the start of the match, ensuring the endpoint reflects the live status more promptly when the match starts.

Also the other endpoint for match info /football/match/:year/:month/:day/$home<[\w\d-\.]+>-v-$away<[\w\d-\.]+> is using a 30 second cache time for all matches. To make it consistent, the same logic is now used for this endpoint so that it'll have 10 seconds cache time for when a match is live or is about to start, otherwise it will have a 300 seconds cache time.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 30, 2026

@marjisound marjisound force-pushed the reduce-match-header-cache-time-before-match-starts branch from e065f5d to e73ff0c Compare March 31, 2026 08:12
@marjisound marjisound force-pushed the reduce-match-header-cache-time-before-match-starts branch from e73ff0c to 708ddd4 Compare March 31, 2026 08:16
@marjisound marjisound marked this pull request as ready for review March 31, 2026 08:19
@marjisound marjisound requested a review from a team as a code owner March 31, 2026 08:19
@marjisound marjisound self-assigned this Mar 31, 2026
@marjisound marjisound changed the title Reduce football match-header cache time before match starts Improve football match-header and match info cache time Mar 31, 2026
val tier = FootballSummaryPagePicker.getTier()

val cacheTime =
if (theMatch.isAboutToStart || theMatch.isLive) CacheTime(10) else CacheTime(300)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm wondering how the new cache time values align with the current cache time settings in Cached.scala e.g.

object Football extends CacheTime(10)
object FootballMatch extends CacheTime(30)

Would it be possible to use (or create) constants in Cached.scala so all the cache time values are in one place?

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

Labels

fix Departmental tracking: fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: "Live feed" tab disappears when navigating to "Match info" during live match

2 participants