Not sure if this is what you're looking for, or even a good solution,
but here's something I've been using: a custom Rack middleware that
wraps each request in a timeout block, so that an exception will be
raised in the app if it takes too long. Here's the code:

  http://gist.github.com/12334

To use it, I add "use RequestTimeout, 10" to my rack.rb, and then make
sure my exceptions.rb is set up to handle the exception with a nice
error message.

As I said, it's entirely possible that this solution has some problem
I haven't thought of, but so far it seems to be doing what I need.

Scott


On Sep 22, 9:57 pm, "Ahsan Ali" <[EMAIL PROTECTED]> wrote:
> It seems that my understanding of deferred actions was muddled: I confused
> render_deferred with render_then_call.
> I will try out deferred actions to see how the application behaves.
>
> Thanks all.
>
> - Ahsan / highandwild
>
> On Tue, Sep 23, 2008 at 12:59 AM, Kyle Drake <[EMAIL PROTECTED]> wrote:
>
> > Take a look at JRuby -  it uses real threads, and shouldn't have this
> > problem (I think).
>
> > -Kyle
>
> > On Wed, Sep 17, 2008 at 12:48 PM, Ahsan Ali <[EMAIL PROTECTED]> wrote:
> > > Thanks for the reply Michael.
>
> > > Deferred actions are out of the question, since I need to make
> > synchronous
> > > calls to the Web Service.
>
> > > EventMachine sounds interesting - I will try it out.
>
> > > Ahsan / highandwild
>
> > > On Wed, Sep 17, 2008 at 9:23 PM, Michael Klishin
> > > <[EMAIL PROTECTED]> wrote:
>
> > >> 2008/9/17 Ahsan Ali <[EMAIL PROTECTED]>:
> > >> > My question is: is there a better solution with Merb ? Would it better
> > >> > to
> > >> > write a tiny merb app that provided a rest interface to my app and
> > >> > interfaced with the soap web service ? But would Merb, which
> > presumably
> > >> > uses
> > >> > green threads, face the same problem with slow system calls ?
>
> > >> 1. Deferred actions.
> > >> 2. Consider writing EventMachine based soap client that is asyc and
> > >> thus does not block. It can use incoming xml/json requests.
> > >> The problem with blocking and HTTP is, it hurts every time you try to
> > >> do something async via HTTP.
> > >> --
> > >> MK
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"merb" 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/merb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to