Forum: Rails-core (closed, excessive spam) ARes can has timeout (patch reviews requested)

00fd4ce27c06ba63e7ddca4c3d67e5ea?d=identicon&s=25 Chu Yeow Cheah (chuyeow)
on 2008-04-21 18:34
(Received via mailing list)
I've been using a lot of APIs in my Ruby (usually Rails) applications
and I've learnt my lesson regarding socket timeouts. Basically, no
response (from an API) is better than a slow response. In the cases of
slow responses, it's better to time out so your ActiveResource clients
can end execution fast (i.e. fail-fast) instead of blocking (for the
default Net::HTTP read_timeout value of 60 seconds) and locking up an
entire web server process.

So the patches for ActiveResource:

 * Introduce ActiveResource::Base.timeout to allow
Net::HTTP#read_timeout to be set  -
http://rails.lighthouseapp.com/projects/8994/tickets/5
 * ActiveResource::Connection should rescue from Timeout::Error  -
http://rails.lighthouseapp.com/projects/8994/tickets/6

Please take a look and share any comments/improvements and feel free
to point out any flaws and laugh at my code.

Cheers,
Chu Yeow
This topic is locked and can not be replied to.