maweki / twitchlive-extension

TwitchLive-Panel Gnome Shell Extension displaying your favorite streamers
GNU General Public License v3.0
38 stars 8 forks source link

Cache game data. #57

Closed zikeji closed 4 years ago

zikeji commented 5 years ago

Figured instead of replying on the PR I'd add an enhancement ticket (though I'm not sure I can tag it :P).

I hadn't even thought about caching game data but yes - it should be cached. The endpoint doesn't return dynamic data either, only the ID, name, and the box art url.

You mention caching it in the session (so I assume in-memory cache), I had thought about an offline cache but the games request is lightweight as-is and shouldn't hog much memory even if someone had 1000 (!) streamers with unique games.

maweki commented 5 years ago

You mention caching it in the session

In general we would want to do as little disk access as possible. We download the user icons to disk because it's just very easy to load icons this way. All settings are stored in gconf. I don't think that anything else is truly necessary.

If we want, we could on launch get the top games (https://dev.twitch.tv/docs/api/reference/#get-top-games) and populate our cache with this. Yeah, I think that would be cool.

zikeji commented 5 years ago

If we want, we could on launch get the top games (https://dev.twitch.tv/docs/api/reference/#get-top-games) and populate our cache with this. Yeah, I think that would be cool.

Unless that data is going to get used, I feel like it's a bit superficial. I added an (experimental?) game ID cache to my fork. Not sure if that's the ideal way to handle it. However, github is doing somethere weird with the PR so I opted not to make one. https://github.com/zikeji/twitchlive-extension

maweki commented 5 years ago

However, github is doing somethere weird with the PR so I opted not to make one.

I think github (or me) did something strange with your original PR. In this repo your API update has a different commit than in yours. So you'd need to rebase against that. But I can just cherry-pick your commit if you want. Your work looks good.

I would still want to do a single top-games request at the beginning to populate the cache. My intuition is, that most people watch the streamers that play the top games anyways. Statistically at least.

maweki commented 4 years ago

@zikeji any update on how you want to handle this? I can just cherry-pick your additions.

zikeji commented 4 years ago

Sorry @maweki - you can cherry pick it.

maweki commented 4 years ago

Okay. Thank I. I cherry-picked you commit and pushed it. I will do a new release in the next version. There seem to be some problems on 3.34 but hopefully there's a fix incoming.