h4l/headgear

Optimise loading time

Opened this issue · 0 comments

h4l commented

Currently it takes a couple of seconds to refresh the Avatar data from Reddit's API after a user changes their Avatar. We cache the data and only refresh when the Avatar is changed. The cache makes it not too bad in general, but the first-load-after-save delay is a bit annoying.

I think it'd be worth seeing if we can reduce the wait. Most of the delay is just making the API call, as it's a massive ~1.1MB JSON doc. If we can notice that a save has occurred, we could initiate the call in the background, so that the data is ready at the point that the user opens Headgear.

Perhaps we can even avoid the call entirely if we could intercept & view the API call that's made to update the Avatar.