On Tue, Sep 29, 2009 at 12:21 AM, Adrian Zehnder <[email protected]> wrote:

>
> We're using nginx with HAProxy and mongrel as well as monit and we're
> integrating with SAP using Piers Harding's sapnwrfc gem. It contains a
> C-extension which calls itself an SAP provided C-library for RFC
> calls. In general it works great.
>
> But there are SAP RFCs with very long runtimes, e.g. orders with a lot
> of items, searches with not restricted enough search criterias, but
> also sporadic hickups in SAP which can happen to any RFC call. They
> can block a mongrel for more than 2 minutes. We therefore need a
> timeout solution.
>
> The 2 available solutions we found (SystemTimer and Terminator) just
> wouldn't work, no matter what we tried.


I too faced the same problem. I could use SystemTimer to timeout rails
requests which did most any tasks like running a system command via %x[], or
sleeping for some time etc, but AR queries to postgresql weren't timed out.
That's when I monkey patched the AR postgresql connection adapter to set a
session "statement_timeout" for postgres. Now postgres times out any query
running for longer than my timeout milli seconds value.

I guess you could do the same with whatever DB or backend service you're
using. Of course, the pure solution would be to find out why SystemTimer
wouldn't work in this case and fix SystemTimer or rails or both depending on
the problem.

cheers,
skar.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to