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

Respect connection timeout options #26

Merged
merged 1 commit into from
Jun 30, 2020
Merged

Conversation

tylerkahn
Copy link
Contributor

@tylerkahn tylerkahn commented Jun 22, 2020

If we don't reassign conn to the result of request_config the timeout config values are not respected.

This can be reproduced pretty easily. Create a request to something like https://httpstat.us/200?sleep=5000 with a timeout set to 1 second using the :net_http adapter and it raises a Faraday::TimeoutError. Change the adapter to :http and no error is raised.

This pull request fixes that behavior.

If we don't reassign `conn` to the result of `request_config` the timeout config values are not respected.
Copy link
Member

@olleolleolle olleolleolle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks right - the explicit return value of #request_config is otherwise a bit unexplainable.

@iMacTia what do you think?

Copy link
Member

@iMacTia iMacTia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just did a quick research as I found strange that conn.timeout would return a new object (and thus needed re-assigning), but looking into the HTTP gem it seems exactly like that: https://github.com/httprb/http/blob/7ce201ebced7a8e23b7ac39aa85c940739b4c3f3/lib/http/chainable.rb#L253

LGTM

@iMacTia iMacTia merged commit f5539ea into lostisland:master Jun 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants