Tuesday, April 17, 2012

Ghosts in Tumblr's Following Lists: A Simple Exorcism

Tumblr has a problem which I refer to as "following ghosts" which happens when a blog you follow which isn't the primary blog of it's user is deleted. The blog goes away, however your blogs followed count will not change and if you look at that list, you'll see a space with no blog title, a blank avatar, a time of last update (Before the blog was deleted) and an unfollow button that, when clicked, gives an error message.
Fixing this problem is probably very low on Tumblr's priority list because functionally it does not interrupt the user experience but as someone who prefers to keep neat lists I find it very, very annoying. So I pondered over the solution a bit.

I have no idea what their data structures look like but for the sake of argument we'll say this:
You have a nice database that consists of a big list of pointers. Each pointer is just an arrow to a blog you follow. When a main blog deactivates, it handily changes the name to something_deactivated3254 leaving it as a valid object in the database to be removed. However, when the blog you followed wasn't their main blog and it is deleted this happens:
This is because your pointer is still aimed at where that blog USED to be which is currently empty space or NULL.
There are a couple ways they could fix this problem. The neatest would be to make it so that blogs are unfollowed when they are deleted. Unfortunately this would both be messy because you are allowing the actions of one user (the deleter) to influence the resources of another (the follower) and also because the sheer volume of traffic moved by tumblr on any given day means they really don't need the kind of extra processing cycle usage that would take.
Similarly having the follow list itself check for validity of blogs passively would just be a big waste of server processing for something that, for all intents and purposes, isn't effecting anyone.
My solution then lies with that handy Unfollow button. It doesn't remove the problem with the list but it puts it on the same level as the deactivated blogs and is actually the shortest to program:
Add basic error checking to your Unfollow button.
It would take a few lines, tops.
You click the Unfollow button, it runs the unfollow query just add quick conditional before that.
If the BlogVariable == NULL then remove the blog from the followed list ELSE do what you normally do to unfollow blogs. I haven't done much in MYSQL but I guarantee this can't be hard to do.
And once it is fixed we can all have nice neat lists unhaunted by dead blogs.

No comments:

Post a Comment