Eliminate any live calls to the API from the web site #401

Closed
opened 2026-08-21 12:21:43 +02:00 by johnsturgeon · 1 comment
Owner

for example, right now current_info takes almost 2 seconds, that's an unacceptable amount of time to add to every single page refresh

for example, right now `current_info` takes almost 2 seconds, that's an unacceptable amount of time to add to every single page refresh
johnsturgeon added reference eliminate-any-live-calls-to-the-api-from-the-web-site-401 2026-08-21 13:02:37 +02:00
Author
Owner

I'm thinking, now, that anything UI related has no business even instantiating an NflApi class, and that we need to just interact with the model, and that there is an offline job that pulls the current info into the DB on a schedule, maybe once every 10 minutes or so. So, here's my proposal:

  • new table in the DB for week_info which has season, week_no and season_type` ints
  • New 'job' that gets run by the scheduler to fetch the current_info from the API every (say) 10 minutes
  • new method to replace the WeekInfo get_current_info to just get it from the DB
  • Ask claude if there is any way for me to 'assert' (sentry log) if the NflApi class is initted within the context of a FastApi route
  • Decommission the 'old' week_info

That should effectively decouple the UI from the API

I'm thinking, now, that anything UI related has no business even instantiating an NflApi class, and that we need to *just* interact with the model, and that there is an offline job that pulls the current info into the DB on a schedule, maybe once every 10 minutes or so. So, here's my proposal: - [ ] new table in the DB for `week_info` which has season, week_no and season_type` ints - [ ] New 'job' that gets run by the scheduler to fetch the current_info from the API every (say) 10 minutes - [ ] new method to replace the WeekInfo get_current_info to just get it from the DB - [ ] Ask claude if there is any way for me to 'assert' (sentry log) if the NflApi class is initted within the context of a FastApi route - [ ] Decommission the 'old' week_info That should effectively decouple the UI from the API
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
johnsturgeon/tgfp-web#401
No description provided.