Skip to content
This repository has been archived by the owner on Apr 25, 2020. It is now read-only.

API requests hang indefinitely #10

Closed
ghost opened this issue Mar 27, 2017 · 7 comments
Closed

API requests hang indefinitely #10

ghost opened this issue Mar 27, 2017 · 7 comments

Comments

@ghost
Copy link

ghost commented Mar 27, 2017

We received this from an API user:

I'm using your forecast_io ruby gem in Rails: https://rubygems.org/gems/forecast_io

When I call the API, it hangs indefinitely:

ForecastIO.forecast(latitude, longitude, time: start_time, params: { exclude: 'flags,minutely,hourly,alert' })

Let me know if I can do anything else to provide more info, or if you know what the problem is.

We're not experiencing any issues directly with the API. Is there any cause that might be specific to the library or to the client that I should request from them?

@czarneckid
Copy link
Contributor

It'd be helpful to know versions for Ruby, the gem, and Rails, that they are currently using. It would also be helpful to know if they're using the default HTTP adapter used by Faraday in the gem, which is Net::HTTP or if they're using another adapter like Typhoeus. If they are using the default Net::HTTP adapter, I believe the default HTTP read timeout is 60 seconds, so I would expect that a request might hang for that long and be killed, not indefinitely.

@ghost
Copy link
Author

ghost commented Mar 27, 2017

Thanks! I'll check with them.

@joevandyk
Copy link

@ironwallaby @czarneckid it would be nice to be able to easily customize the timeout with this gem.

@czarneckid
Copy link
Contributor

@joevandyk You should be able to do this via Faraday. See the following issue for details on how to add this customization.

@jon-eckstein
Copy link

@czarneckid Looking at the issue you linked to above, I would still have to monkey patch the forecast.io gem to achieve a configurable timeout correct? It looks like Faraday only allows setting the timeout params on connection creation.

@kulte
Copy link
Contributor

kulte commented Dec 7, 2017

It would just be nice if you added timeout as an option in Configuration. I went digging in the Faraday codebase for this, and it's just annoying to try to figure out how I'd pull this off... and yes, like @jon-eckstein said, it looks like it might require a money patch, which I'd like to avoid. Thanks 🙏

@kulte
Copy link
Contributor

kulte commented Jan 25, 2018

@ironwallaby I just added this PR which should completely fix the issue. It would be great to get this merged ASAP so we (and everyone) can start using timeouts if we so choose! Thanks!!

czarneckid added a commit that referenced this issue Jan 30, 2018
Add optional request read timeout to Faraday [Fixes #10]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants