Parallelize championship hub fetches and cache aggregated response

Cold-cache hub loads previously issued ~70 sequential OpenF1 calls.
Per-meeting fetches now fan out 5-wide (order preserved), and the
aggregated response is cached in memory: 15min TTL for the current
season, 24h for past seasons.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-03 00:14:07 -04:00
parent 2220d5d30a
commit 282b5a8c24
3 changed files with 215 additions and 11 deletions

View File

@@ -20,10 +20,11 @@ var assetsFS embed.FS
// Server is the box-box web companion HTTP server.
type Server struct {
client *api.OpenF1Client
query *query.Service
hub *SSEHub
addr string
client *api.OpenF1Client
query *query.Service
hub *SSEHub
addr string
hubCache champHubCache // aggregated championship hub responses, keyed by year
}
// NewServer creates a new Server. Call Start() to begin serving.