Skip to content

Commit

Permalink
reconnect 15 min laster after receive max reconnect error
Browse files Browse the repository at this point in the history
  • Loading branch information
siuying committed Oct 11, 2010
1 parent 08c36da commit d7f1d3c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/reflect/reflect.rb
Expand Up @@ -57,7 +57,15 @@ def listen
end

stream.on_max_reconnects do |timeout, retries|
@logger.error "max reconnects reached"
@logger.error "max reconnects reached: timeout: #{timeout}, retries: #{retries}"

# reconnect after 15 minutes
stream.stop
sleep(900)
stream = Twitter::JSONStream.connect(
:path => "/1/statuses/filter.json?follow=#{@user_id}",
:auth => @twitter_auth
)
end

trap('TERM') {
Expand Down

0 comments on commit d7f1d3c

Please sign in to comment.