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

Celluloid Timeout Support #225

Closed
aronchick opened this issue May 12, 2015 · 8 comments
Closed

Celluloid Timeout Support #225

aronchick opened this issue May 12, 2015 · 8 comments
Milestone

Comments

@aronchick
Copy link

I know that current Celluloid Timeouts are currently not supported, but is there an interim workaround?

Here's the code I'd like to run:

  def fetch(url, options = {} )
    puts "Request -> #{url}"
    begin
      options = options.merge({ socket_class: Celluloid::IO::TCPSocket,
                                timeout_class: HTTP::Timeout::Global,
                                timeout_options: {
                                  connect_timeout: 1,
                                  read_timeout: 1,
                                  write_timeout: 1
                                  }
                              })
      HTTP.get(url, options)
    rescue HTTP::TimeoutError => e
      [do more stuff]
    rescue Exception => e
      puts e
    end
  end

Its goal is to test a server as being live and healthy.

@zanker
Copy link
Contributor

zanker commented May 12, 2015

Set options = options.merge(socket_class: Celluloid::IO::TCPSocket, timeout_class: HTTP::Timeout::Null) should work, as it bypasses the timeout code.

@aronchick
Copy link
Author

Interesting! Can we call that with different values?

On Tue, May 12, 2015 at 12:04 PM, Zachary Anker notifications@github.com
wrote:

Set options = options.merge(socket_class: Celluloid::IO::TCPSocket,
timeout_class: HTTP::Timeout::Null) should work, as it bypasses the
timeout code.


Reply to this email directly or view it on GitHub
#225 (comment).

@zanker
Copy link
Contributor

zanker commented May 12, 2015

Which part with different values? Not quite sure what you mean.

@aronchick
Copy link
Author

Sorry, I was hoping to have the ability to set a timeout at 1s for some
requests, and 20s for other requests. Is that variable?

On Tue, May 12, 2015 at 2:35 PM, Zachary Anker notifications@github.com
wrote:

Which part with different values? Not quite sure what you mean.


Reply to this email directly or view it on GitHub
#225 (comment).

@zanker
Copy link
Contributor

zanker commented May 12, 2015

If you aren't using Celluloid IO, you can change it to whatever you want, but we don't support timeouts when using Celluloid IO right now.

@aronchick
Copy link
Author

I guess that's my issue - I'm using Celluloid IO - is there an alternative
for Timeouts?

On Tue, May 12, 2015 at 2:40 PM, Zachary Anker notifications@github.com
wrote:

If you aren't using Celluloid IO, you can change it to whatever you want,
but we don't support timeouts when using Celluloid IO right now.


Reply to this email directly or view it on GitHub
#225 (comment).

@zanker
Copy link
Contributor

zanker commented May 12, 2015

I'm not familiar enough with Celluloid IO to offer a suggestion, sorry.

@tarcieri
Copy link
Member

Closing this. Please continue discussion in #272

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

No branches or pull requests

4 participants