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

Adds Faraday options "timeout" and "open_timeout" accessible in her config #400

Merged
merged 1 commit into from
Jan 6, 2017

Conversation

abhikalakuntla
Copy link

Contrary to the the comments in this issue: #120, the options timeout and open_timeout are not being accepted by Her.

Github page for Faraday

@SirRawlins
Copy link

Any reason this hasn't been merged in?

@abhikalakuntla
Copy link
Author

bump

@edtjones
Copy link
Collaborator

hi @abhikalakuntla I've just got commit access on this repo and plan to get back on track with maintenance over time - will be in touch soon!

@abhikalakuntla
Copy link
Author

abhikalakuntla commented Oct 25, 2016

@edtjones hi, any update? :)

@edtjones
Copy link
Collaborator

@abhikalakuntla sorry for the delay.

@ticktricktrack this feels like one which should be easy to merge. Do you agree?

@abhikalakuntla
Copy link
Author

bump

@edtjones
Copy link
Collaborator

edtjones commented Jan 5, 2017 via email

@edtjones edtjones merged commit 9157d9f into remi:master Jan 6, 2017
@edtjones
Copy link
Collaborator

edtjones commented Jan 6, 2017

@abhikalakuntla I've just released version 0.8.4 with this PR merged. I'm really grateful for the input - thankyou.

@abhikalakuntla
Copy link
Author

Thank you :)

@SirRawlins
Copy link

Sweet job on getting this merged in! Was running off @abhikalakuntla's branch so I had this support, nice to be back on the upstream.

Good job folks!

@edtjones
Copy link
Collaborator

Thanks @SirRawlins - would be delighted to have whatever input you have time for.

@etiennebarrie
Copy link

I can't seem to be able to pass timeout and open_timeout directly to Her::API#setup with Faraday 0.11.0, this is the backtrace I get:

~/.gem/ruby/2.3.1/gems/faraday-0.11.0/lib/faraday/options.rb:31:in `block in update': undefined method `timeout=' for #<Faraday::ConnectionOptions:0x007fd289aecf50> (NoMethodError)
Did you mean?  timeout
	from ~/.gem/ruby/2.3.1/gems/faraday-0.11.0/lib/faraday/options.rb:20:in `each'
	from ~/.gem/ruby/2.3.1/gems/faraday-0.11.0/lib/faraday/options.rb:20:in `update'
	from ~/.gem/ruby/2.3.1/gems/faraday-0.11.0/lib/faraday/options.rb:52:in `merge'
	from ~/.gem/ruby/2.3.1/gems/faraday-0.11.0/lib/faraday/connection.rb:61:in `initialize'
	from ~/.gem/ruby/2.3.1/gems/faraday-0.11.0/lib/faraday.rb:67:in `new'
	from ~/.gem/ruby/2.3.1/gems/faraday-0.11.0/lib/faraday.rb:67:in `new'
	from ~/.gem/ruby/2.3.1/gems/her-0.8.4/lib/her/api.rb:76:in `setup'

I was able to fix it by setting the two options inside the block instead of using them as parameters instead, as mentioned in lostisland/faraday#417 (comment):

timeout = options.delete(:timeout) || 5
open_timeout = options.delete(:open_timeout) || 1
Her::API.setup(options) do |connection|
  connection.options.timeout = timeout
  conn.options.open_timeout = open_timeout
end

so I'm not sure :timeout and :open_timeout should be in FARADAY_OPTIONS.

@edtjones
Copy link
Collaborator

@abhikalakuntla @SirRawlins can you help with this?

@zacharywelch
Copy link
Collaborator

zacharywelch commented Jun 11, 2017

@etiennebarrie believe you're correct and these options were always available as part of the request hash or within the builder as you suggested.

Her::API.setup(url: "https://api.example.com", request: { timeout: 10, open_timeout: 2 })

/cc @abhikalakuntla @SirRawlins

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.

None yet

6 participants