Behind the Scenes: Fixing 0.4.0

Behind the Scenes is a new blog category for FreeTube where I go over upcoming features or recent issues that have been addressed. These may end up more technical than release blogs, but I guess we'll see how that turns out when I get there. This is my first time doing something like this so feedback is greatly appreciated.

Why is 0.4.0 Slow?

A few users have noted that 0.4.0 has been a bit slower when it comes to navigating, especially compared to 0.3.2. This is partly because of the switch to the Invidious API. The Invidious server is not nearly as fast as Google's, which shouldn't come as a surprise. This simply means that information won't be sent to FreeTube as quickly as it would if I was getting it directly from Google.

This is a small sacrifice for the extra privacy (and lack of quota issues) that we get from not using YouTube's API directly. Invidious is scraping YouTube's website which will never be as fast as getting data directly from Google. This isn't to say that the process is slow, as it isn't really noticeable unless you are loading your subscriptions, which brings me to my next point.

FreeTube uses the Subscriptions button in the side menu to reload your subscriptions. In the early days, this was done as the only way to display your subscriptions. Things have been changed now and there isn't a need for that button to refresh your subscriptions every time it is clicked. The data is already stored locally and becomes visibly shown when you click on Subscriptions, but your subscriptions refresh in the background regardless.

The only fail safe that is currently included is more so to prevent users from spam clicking the button which would force the app to a crawl because of the multiple API requests. When you click on the Subscriptions button, a 1 minute timer is set where you can click on that button as many times as you'd like. When the timer is finished, clicking the button again will refresh your subscriptions. This timer feels non-existent during normal usage of FreeTube.

This constant refreshing of subscriptions holds back any other API calls that the user might use, which makes searches or loading a video feel slow.

The Solution

This solution is actually pretty simple. I've changed the timer to 2 hours instead of 1 minute. This quick change should make FreeTube run much better overall compared to 0.4.0. Once the 2 hours are up, clicking on the Subscriptions button will then reload the subscriptions.

Now, obviously there are some users that feel like that time should be different. Some might want that timer to be less, some might not want it at all. I have to make a decision on what works best for as many people as possible and I believe 2 hours is a good number.

For those that want their subscriptions to refresh a little bit more often than that, I have a solution for you as well. I have added a new refresh button at the top of the menu, which will force your subscriptions to reload. You will also be able to use Ctrl + R as a substitute. Again, I don't want users to spam click this button, so a separate 5 minute timer is set for this button to prevent it. Clicking on this button will also reset the 2 hour timer from the main Subscriptions button

Why Are Subscriptions Failing to Load?

This is a completely different issue sort of caused by the same reason. Recently subscriptions would fail to load because of a failure with the Invidious API. The cause is actually because of 2 different reasons. The first one is because of a server time out, which is something that I have no control over. The other reason is because a channel in the subscription list has been banned or deleted. If either one of these issues occur, even for one channel, subscriptions won't load at all.

The Solution

The solution for this isn't too exciting honestly. I've made @omarroth aware of the first issue and he will let me know when he finds a solution. In the mean time, I've added some checks in FreeTube that will recognize when these errors occur and allow the subscriptions to continue without that channel.

FreeTube will notify you if it couldn't load a channel and will display which channel it couldn't load. If you consistently see the same channel unable to load, there's a good chance that the channel has been deleted or banned. Try to load that channel's page and see if it loads. If the page doesn't load, then that channel has been deleted and safe to be removed from your subscriptions. I don't want to remove subscriptions automatically to avoid confusion so this is the best I can do for now.

Conclusion

There were some other small issues that occurred within FreeTube, but these were the major 2 that has bothered the most amount of people. These fixes should be released hopefully some time this weekend. I hope this provides some insight on what goes on with FreeTube and how solutions are made. I appreciate your feedback on this blog as I'd like to make more as development continues.

Take care!