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.

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

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- - Ezra Zygmuntowicz -- Founder & Software Architect -- ezra@engineyard.com -- EngineYard.com

Whoops! Thanks for that Ezra.