Repository navigation
Add cached emotes fallback for failed provider fetches - #6125
Conversation
|
Haven't looked at the changes (which would answer this,) but would be interested to know if you'd start seeing emotes in messages pulled from recent messages on startup 🤔 |
Isn't this already the case? I'm on latest nightly and I see what you described |
|
Thanks for your PR, I'll take a look later this week |
Nerixyz
left a comment
There was a problem hiding this comment.
but would be interested to know if you'd start seeing emotes in messages pulled from recent messages on startup
Recent messages and the emote providers are racing. If we load cached emotes, we should be more likely to have loaded emotes when the recent messages response comes back. I couldn't find an issue, but there was some talk about saving the user-id in the window layout such that a channel will know its user-id on startup. This way we could load emotes even earlier, but should delay loading the message history.
| QThreadPool::globalInstance()->start([bytes, id, provider]() { | ||
| QFile responseCache(getApp()->getPaths().cacheDirectory() + "/" + id + | ||
| "." + provider); | ||
|
|
||
| if (responseCache.open(QIODevice::WriteOnly)) | ||
| { | ||
| qCDebug(chatterinoCache) | ||
| << "Saved json response " << id << "." << provider; | ||
| responseCache.write(qCompress(bytes)); | ||
| } | ||
| }); |
There was a problem hiding this comment.
is writing to a file really so slow that this needs to be done on a separate thread?
There was a problem hiding this comment.
In my opinion, yes. For example I have an external 10 TB HDD, which if it hasn't been used a while needs time to be responsive again. If the drive, the file is located on, is being used a lot anyways I don't see it as a big problem, tho.
There was a problem hiding this comment.
I'd also like to mention that some users have a stupid amount of emotes on 7tv, given the generous emote capacity provided
There was a problem hiding this comment.
nymn's 7TV channel emotes, even compressed, is 589KB
some of it has to do with how large the network payload is since we're not only storing raw emote id/url stuff, but still kinda large
this just helps you get a full path to a file in the cache directory
|
Thank you! As a first-time contributor, you are now eligible to be listed in the About page in Chatterino. If you want this, you can open a new PR where you modify the |
This PR introduces a cached fallback mechanism for emotes when provider API requests fail, lessening the pain of service hiccups
Things I'd like to note:
Closes #5676