class Elastictastic::ExconAdapter
Public Instance Methods
request(method, path, body = nil)
click to toggle source
# File lib/elastictastic/adapter.rb, line 55 def request(method, path, body = nil) retried = false begin response = connection.request( :body => body, :method => method, :path => path ) Response.new(response.status, response.headers, response.body) rescue Excon::Errors::SocketError => e case e.socket_error when Errno::EPIPE, Errno::ECONNRESET if !retried connection.reset retried = true retry end end raise end rescue Excon::Errors::Error => e connection.reset raise ConnectionFailed, e end
Private Instance Methods
connection()
click to toggle source
# File lib/elastictastic/adapter.rb, line 80 def connection @connection ||= Excon.new(@host, connection_params) end
connection_params()
click to toggle source
# File lib/elastictastic/adapter.rb, line 84 def connection_params @connection_params ||= {}.tap do |params| if @request_timeout params[:read_timeout] = params[:write_timeout] = @request_timeout end if @connect_timeout params[:connect_timeout] = @connect_timeout end end end