Include yesterday live matches in our cached data#28885
Merged
Conversation
This is to avoid losing updates for matches that started yesterday but haven't yet finished
Contributor
0a5b27d to
4c76036
Compare
marjisound
commented
Jun 26, 2026
| val newSummary = newMatch.statusSummary | ||
| val oldSummary = oldMatch.statusSummary | ||
| if (newSummary != oldSummary) log.debug(s"Match Status Changed $oldSummary -> $newSummary") | ||
| if (newSummary != oldSummary) log.info(s"Match Status Changed $oldSummary -> $newSummary") |
Contributor
Author
There was a problem hiding this comment.
Changed the match status log from DEBUG to INFO level for better visibility during the World Cup. This helps track any unexpected data inconsistencies that might arise. We can revert this to DEBUG after the tournament.
Jakeii
reviewed
Jun 26, 2026
4c76036 to
a674a55
Compare
alexduf
approved these changes
Jun 26, 2026
Jakeii
approved these changes
Jun 26, 2026
Jakeii
left a comment
Member
There was a problem hiding this comment.
Looks good, nice work finding an efficient solution!
|
Seen on ADMIN-PROD (merged by @marjisound 8 minutes and 3 seconds ago)
|
|
Seen on FRONTS-PROD (merged by @marjisound 10 minutes and 16 seconds ago)
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this change?
This PR updates the refreshMatchDay implementation to prevent losing live match updates when the date boundary changes (midnight). The job now checks if any match in the cache started yesterday but still has isLive = true. If so, it makes an additional PA call to fetch yesterday's matches alongside today's, ensuring we capture score updates for matches that span the date boundary.
How
The implementation:
liveMatchesFromYesterday()to detect live matches from the previous dayKnown timezone quirk:
PA always returns match data in Europe/London timezone, while the Sport server uses UTC as its default clock. Although ZonedDateTime handles this correctly in most cases, refreshMatchDay uses LocalDate.now(clock) which can cause a one-hour discrepancy during BST (British Summer Time). Specifically, between midnight and 1 AM during summer months, we may fetch yesterday's matches even though technically it's already "today" in London time.
Although this is better to get fixed, I prefer not to do it as part of this PR to minimise the changes and reduce the risk as we are in the middle of the world cup.
Ticket is created for this #28887
Testing
To properly unit test this scenario, I created a testCompetitionsServiceWithMatchDayResponses helper that allows stubbing PA responses for specific dates. This lets us:
The test validates that:
Fixes guardian/dotcom-rendering#16241