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.
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.
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.
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.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.