How to make rails wait

Hi,everyone.Here’s my situation:
I have a controller like this:
class FooController < ApplicationController
def delay
sleep 10
render :text=>“ok”
end

    def normal
          render :text=>"ok"
    end

end

but I found that “sleep 10” will not only make the current request
delay 10 seconds,but also make the whole server sleep 10 seconds. That
means if I request "/foo/delay"and “/foo/normal” sequently on my
Browser,they both response after 10 seconds.But I only want the first
request delay 10 seconds while the others can normally work.
any Idea? thanks in advance

This is because mongrel and Webrick will only serve one request at a
time.

On Tue, May 27, 2008 at 4:17 PM, fanz [email protected] wrote:

         render :text=>"ok"


Appreciated my help?
Recommend me on Working With Rails
http://workingwithrails.com/person/11030-ryan-bigg

This is because mongrel and Webrick will only serve one request at a time.

Yes. And to be more specific: you have to use Mongrel cluster (do
‘sudo gem install mongrel_cluster’ and see
mongrel_rails howto - Google Search)
for being able to serve more than one request simultaneously in
development.

Karel

On May 26, 2008, at 11:54 PM, Ryan B. (Radar) wrote:

This is because mongrel and Webrick will only serve one request at a
time.

Actually this is because rails can only serve one request at a time
as it is single threaded. Other frameworks and apps that run on
mongrel or webrick have no problems serving concurrent requests.

Cheers-

On Wed, May 28, 2008 at 11:00 AM, Ezra Z. [email protected]
wrote:

Whoops! Thanks for that Ezra.


Appreciated my help?
Recommend me on Working With Rails
http://workingwithrails.com/person/11030-ryan-bigg

I have to say the “deferred” feature in merb is pretty darn cool.
Basically make any process run in the background by just wrapping it in
a deferred block. I can’t wait for Rails on Rack to be finished though.
It is a major step in the right direction.