I’ve been messing with Rails when trying to set up a server with a web service and a controller that consumes that web service. Actually, that’s not easy at all, as the controller times out when calling the web service. It should have worked if the web service was remote.

So the thing is that requests are queued (didn’t know that), and therefore it seems that you can’t perform a recursive request (a controller that calls a URL in its own server). Anyway, you can deploy two servers, such as here, where it’s also mentioned that a trick editing concurrent connections should make it work.

EDIT: I’ve checked Mongrel’s FAQ. It seems that Mongrel is actually concurrent, in the sense that a new thread is created whenever a connection is accepted. I suppose that recursive requests are not possible due to dispatch guarding in the server, though I’m not sure why a new thread isn’t created for child requests in that case. To make all this work in a single server, you just have to include:

ActionController::Base.allow_concurrency=true

in your environment.rb. And then, pray (as it’s unsafe to allow concurrency).



2 Responses to “Recursive requests in Rails”  

  1. 1 Idetrorce

    very interesting, but I don’t agree with you
    Idetrorce

  2. 2 jos442

    Hi Idetrorce! What do you think is wrong in the post?

Leave a Reply