So apparently the issue is not that timeout is not functioning. I can
run a server locally, make it not return a response within the timeout
limit, and see that timeout works.
The issue is in fact that if the server does not accept the connection,
timeout does not function as I expected it to - it doesn''t function at
all. It appears as though timeout only works when the server accepts the
connection but takes too long to respond.
To me, this seems like an issue - shouldn''t timeout also work when the
server I''m contacting is down? If not, there should be another
mechanism
to stop a bunch of requests from hanging...anyone know of a quick way to
do this?
Ben Porterfield wrote:>
>
> I''m trying to contact a REST API using ActiveResource on Rails
2.3.2.
>
> I''m attempting to use the timeout functionality so that if the
resource
> I''m contacting is down I can fail quickly - I''m doing
this with the
> following:
>
> class WorkspaceResource < ActiveResource::Base
> self.timeout = 5
> self.site = "http://mysite.com/restAPI"
> end
>
> However, when I try to contact the service when I know it isn''t
> available, the class only times out after the default 60 seconds. I can
> see from the error stack that the timeout error does indeed come from an
> ActiveResource class in my gem folder that has the proper functions to
> allow timeout settings, but my set timeout never seems to work.
>
> Any thoughts?
--
Posted via http://www.ruby-forum.com/.