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

Better timeouts API #205

Closed
ixti opened this issue Apr 6, 2015 · 3 comments
Closed

Better timeouts API #205

ixti opened this issue Apr 6, 2015 · 3 comments
Labels
Milestone

Comments

@ixti
Copy link
Member

ixti commented Apr 6, 2015

IMO it worth add a bit more simple way of timeouts configuration:

HTTP.with_timeout(:per_request, :connect => 5, :read => 10, :write => 15) 
@ixti ixti added this to the v0.9 milestone Apr 6, 2015
@zanker
Copy link
Contributor

zanker commented Apr 6, 2015

I would keep the ability to set a class, because it let's people write their own still. Although something that's maybe symbol or class would work.

And yea sorry, this slipped my mind. Realized it later when Tony brought it up.

@tarcieri
Copy link
Member

tarcieri commented Apr 6, 2015

I think I'd like to prefer the proliferation of #with_* prefixed things. I kind of regret introducing that convention in the first place.

I'd suggest HTTP.timeout

@ixti
Copy link
Member Author

ixti commented Apr 6, 2015

Both points make sense to me, so I guess it can be something like (pseudo code):

module HTTP
  def self.timeout(klass, opts = nil)
    timeout = Timeout[klass].new(opts)
  end

  class Timeout
    def self.[](klass_or_symbol)
      return klass_or_symbol if klass_or_symbol.is_a? Class
      case klass_or_symbol
      when :per_operation then PerOperation
      # ...
      end
    end
  end
end

@ixti ixti added the Feature label Apr 12, 2015
@ixti ixti closed this as completed in 3121dad May 6, 2015
zanker pushed a commit to zanker/http.rb that referenced this issue May 8, 2015
@ixti ixti modified the milestones: v0.10, v0.9 Jul 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants