Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset http connection on timeouts #99

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/elastomer/client.rb
Expand Up @@ -187,6 +187,11 @@ def request( method, path, params )

# wrap Faraday errors with appropriate Elastomer::Client error classes
rescue Faraday::Error::ClientError => boom
# reset connection on timeouts to avoid reading incorrect response on next request
if Faraday::Error::TimeoutError === boom
@connection = nil
end

error_name = boom.class.name.split('::').last
error_class = Elastomer::Client.const_get(error_name) rescue Elastomer::Client::Error
raise error_class.new(boom, method.upcase, path)
Expand Down