55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
# 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., 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
|