lostisland / lostisland/faraday
Distinguish TimeoutErrors for open and read timeouts
- Dominant language
- Ruby
- Stars
- 5.9k
- Forks
- 1k
- Avg merge
- 5d 17h
- Merged PRs (30d)
- 6
Description
In faraday/adapter/rack.rb, TimeoutError is raised for both open and read timeouts:
```
timeout = env[:request][:timeout] || env[:request][:open_timeout]
response = if timeout
Timer.timeout(timeout, Faraday::Error::TimeoutError) { execute_request(env, rack_env) }
else ... end
```
According to https://stackoverflow.com/questions/10322283/what-is-timeout-and-open-timeout-in-faraday, open_timeout is for the tcp connection and timeout is for the response read.
It would be nice to have separate exception types for these timeouts. Then we could determine whether or not to retry the request. Does adding something like Faraday::Error::OpenTimeoutError and Faraday::Error::ResponseTimeoutError and using those here make sense?
Contributor guide
Research direction
Start by reading the timeout handling in faraday/adapter/rack.rb and review the issue discussion for the proposed exception semantics. Trace how open and response-read timeouts are distinguished, then verify that separate exception types allow callers to make different retry decisions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100