Skip to content

Commit

Permalink
Making twitter connection retry on Reconnect exception being thrown
Browse files Browse the repository at this point in the history
  • Loading branch information
ennui2342 committed Nov 7, 2013
1 parent 8a6c5d5 commit 76930f4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/qswarm/clients/twitter.rb
Expand Up @@ -56,6 +56,10 @@ def run
emit(:raw => status.attrs, :type => :track, :topic => topic, :matches => matches, :text => status.text)
end
end
# end.on_limit do |skip_count|
# Qswarm.logger.error "[#{@agent.name.inspect} #{@name.inspect}] There were #{skip_count} tweets missed because of rate limiting."
end.on_error do |message|
Qswarm.logger.error "[#{@agent.name.inspect} #{@name.inspect}] #{message}"
end
end

Expand All @@ -68,15 +72,19 @@ def run
emit(:raw => status.attrs, :type => :follow, :group => group, :user_id => status.user.id, :text => status.text)
end
end
# end.on_limit do |skip_count|
# Qswarm.logger.error "[#{@agent.name.inspect} #{@name.inspect}] There were #{skip_count} tweets missed because of rate limiting."
end.on_error do |message|
Qswarm.logger.error "[#{@agent.name.inspect} #{@name.inspect}] #{message}"
end
end
end

rescue TweetStream::ReconnectError
Qswarm.logger.info "[#{@agent.name.inspect} #{@name.inspect}] Hit max reconnects, restarting tweetstream in 60 seconds ..."
EM.timer(60, run)
end
end
end
end
end

Expand Down

0 comments on commit 76930f4

Please sign in to comment.