Skip to content

Instantly share code, notes, and snippets.

@kimchy
Created January 12, 2011 16:52
Show Gist options
  • Select an option

  • Save kimchy/776445 to your computer and use it in GitHub Desktop.

Select an option

Save kimchy/776445 to your computer and use it in GitHub Desktop.
rubberband with keep alive
def connect!
unless defined?(@@patron_session)
@@patron_session = Patron::Session.new
@session = @@patron_session
@session.base_url = @server
@session.timeout = @options[:timeout]
@session.headers['User-Agent'] = 'ElasticSearch.rb v0.1'
@session.headers['Connection'] = 'Keep-Alive'
else
@session = @@patron_session
end
@request_count = 1
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment