8000 Typehous Faraday Adapter timeouts not working · Issue #715 · typhoeus/typhoeus · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Typehous Faraday Adapter timeouts not working #715
Open
@Jaleelahmed94

Description

@Jaleelahmed94

Hello,
I was working on configuring timeouts for faraday requests using typehous but noticed that for typehous adapter the timeout values are not adhered.

Example code:

require "bundler/inline"

gemfile do
  source "https://rubygems.org"

  ruby "2.7.6"

  gem "faraday", "~> 1.7.0"
  gem "typhoeus", "~> 1.4.0"
end

require "faraday"
require "typhoeus/adapters/faraday"


def net_http
  p 'net_http'
  conn = Faraday::Connection.new('https://httpstat.us')
  conn.options.timeout = 1
  conn.options.open_timeout = 20
  conn.options
  conn.adapter :net_http
  
  p conn
  # => #<Faraday::RequestOptions timeout=1, open_timeout=20>
  conn.get('/200?sleep=800')
end

def typhoeus
  p 'typehous'
  conn = Faraday::Connection.new('https://httpstat.us')
  conn.options.timeout = 1
  conn.options.open_timeout = 20
  conn.options
  conn.adapter :typhoeus
  
  p conn
  # => #<Faraday::RequestOptions timeout=1, open_timeout=20>
  conn.get('/200?sleep=800')
end

def handle
  yield
rescue => e
  p e.class
end

handle { typhoeus }
handle { net_http }

For the above code net_http adapter requests always succeed but all the typehous requests seem to be timing out.
The typheous request is only succeeding if the sleep time is set to something around 500 or below.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0