Getting Rate Limit Exceeded unexpectedly

rate-limits

#1

We have at least 1 user in particular for whom we are getting Rate Limit Exceeded errors unexpectedly. Here are the details:

  1. Our service only allows users to follow 1 user per minute and unfollow 1 user per minute
  2. One user has claimed emphatically that he/she does not have ANY other apps authorized except ours (so the rate limit is only from our requests)
  3. Even after not sending a single request overnight, this morning this user tried to follow some users and got Rate Limited before following even 10 users from our site, and that’s spread out over 10 minutes (1 per minute)
  4. Using the same 1 per minute schedule, the user’s unfollows never get rate limited, only the follows
  5. This user has 16k followers and is following 10k, so it’s not an account level limit either
  6. We use the Twitter Rails gem which doesn’t provide rate limit information in the responses (unfortunately)

Why could this be happening? It’s not occurring with other users (that we’ve seen at least) and there seems to be no reason for us to be rate limited for the follows (and not the unfollows for that matter since the rate limit is the same).


#2

In my experience, that typically happens shortly before either the account gets locked (326 error code) or your application gets restricted.

I have similar restrictions on my platform but I use 1 follow per 2 minutes and 1 unfollow per 2 minutes with daily caps at 300 followers and 1,000 unfollows. I also use a formula to predict whether the user is around the 5,000 following limit to temporarily lock accounts that need to fix their ratio (though 16,000 followers and 10,000 following would not be caught by this so it’s a moot point). If someone manages to get the 161 error after bypassing my filter then I freeze all follows/unfollows in my app for 10-30 minutes and lock that individual account for 3 hours to let it clear.