Closed jsaelhof closed 2 years ago
I tried making ratings purely on demand from the OMDB api. I ended up scrapping the idea because the it either means that I'm making a request on load for every movie (which is potentially hundreds at once) or I'm doing it when i open the card and there's a lag waiting for the api to return. I decided to keep the ratings in my DB and I optimized the refresh. I created a mutation to fetch new ratings and store them in my DB but it only does it on the first time a movie is focused for the session and only if the movie is within about a year (current year minus 1). I don't really need to refresh ratings on older movies because they likely haven't changed. It's only pretty new movies that need this.
Ratings change over time so i'm now updating them in the DB by fetching them on rollover and then pushing them to the DB. On the pick screen i'm just displaying them without actually updating the DB. It occurred to me at this point that maybe there's no point keeping the ratings data in the DB? I'm fetching it every time it's displayed now so there's not much point in keeping my own copy. I could probably do the same with some other data like year but then I can't have a movie that isn't in the API. Anyway, it would be to think about what data i'm replicating in my DB that could just live in the API.