REST API Connect Timeouts


#1

I am seeing consistent request timeouts when trying to hit user or search api endpoints. The client is written Ruby using twitter gem(https://github.com/sferik/twitter).

On debugging, I found out that the gem has a default open_timeout set to 5 seconds. I tried increasing this to 30 secs, but still didnt get any response from twitter.

These timeouts started happening around 6-7 PM UTC, Saturday(Oct 18th)


#2

Are you able to share any simple code that repeatedly demonstrates the issue?


#3

I am using the twitter gem.

twitter = Twitter::REST::Client.new do |config|
  config.consumer_key = TwitterConfig::CLIENT_ID
  config.consumer_secret = TwitterConfig::CLIENT_SECRET
  config.access_token = handle.access_token
  config.access_token_secret = handle.access_secret
end

for i in 1..100
  begin
     twitter.search("Hello", {:count => 1})
  rescue Exception => e
    p "Error^^^^^^^^^ #{e.message}"
  end
end

This loop failed 6-7 times with “Execution Expired” message and this happens consistently on every run.


#4

time curl --get ‘https://api.twitter.com/1.1/search/tweets.json’ --data ‘count=1&q=%22twitter%22’ --header ‘Authorization: OAuth oauth_consumer_key="<>", oauth_nonce="<>", oauth_signature="<>", oauth_signature_method=“HMAC-SHA1”, oauth_timestamp=“1413706835”, oauth_token="<>", oauth_version=“1.0”’

real 2m7.476s
user 0m0.020s
sys 0m0.132s

real 2m7.478s
user 0m0.048s
sys 0m0.116s


#5

Not sure if this will help, but all my servers are hosted in aws and are in us-east-1a zone