Add incremental TBA match cache with per-event If-Modified-Since support#35
Draft
Add incremental TBA match cache with per-event If-Modified-Since support#35
Conversation
Co-authored-by: simra <2946735+simra@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add local cache for match data to reduce re-fetching
Add incremental TBA match cache with per-event If-Modified-Since support
Feb 25, 2026
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.
Every call to
fetch_all_matcheswas doing a full re-fetch of all events and all matches, ignoring HTTP conditional-request semantics at the per-event level. Three root causes:if_modified_sincetimestamp (from the events-list response) was reused for every individual event match/team fetch — too coarse-grained.matchesandevent_teams(noted in a TODO).try/exceptwrapped the entire event loop, so anyApiException(304)from one event aborted all remaining fetches.Changes (
current/backend/TBA.py)Last-Modifiedtracking — newevent_last_modifieddict in the cache stores theLast-Modifiedresponse header keyed byevent.keyafter each successful fetch.get_event_matches/get_event_teamscall uses its own stored timestamp; TBA can return304for unchanged events independently.try/except; a304for one event keeps cached data and continues the loop.result.setdefault(...)so existingmatches,event_teams, andevent_last_modifiedare always preserved across fetches.reset=True— passes emptyif_modified_sincefor every call to force a full re-fetch when needed.Structure
New
current/folder mirrors2024/backend/and serves as the active season backend.swagger_clientis symlinked from2024/backend/swagger_clientto avoid duplication.💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.