diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-06-23 06:56:12 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-06-23 06:56:12 +0000 |
commit | 0c3298f2f205dac516216a1d48dcc21112312c2d (patch) | |
tree | 671cfc66c362d950528b5cc8e843edb422c640f2 /railties | |
parent | 413d10ceeccae85e7f418961be886a192b340a3a (diff) | |
download | rails-0c3298f2f205dac516216a1d48dcc21112312c2d.tar.gz rails-0c3298f2f205dac516216a1d48dcc21112312c2d.tar.bz2 rails-0c3298f2f205dac516216a1d48dcc21112312c2d.zip |
Added ActionController::Base.allow_concurrency to control whether the application is thread-safe, so multi-threaded servers like WEBrick knows whether to apply a mutex around the performance of each action. Action Pack and Active Record are by default thread-safe, but many applications may not be. Turned off by default.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1487 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties')
-rw-r--r-- | railties/CHANGELOG | 2 | ||||
-rw-r--r-- | railties/lib/webrick_server.rb | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/railties/CHANGELOG b/railties/CHANGELOG index 444a918a7c..62e7fdcaae 100644 --- a/railties/CHANGELOG +++ b/railties/CHANGELOG @@ -1,6 +1,6 @@ *SVN* -* Removed the mutex from the WEBrick adapter under the production environment so concurrent requests can be served +* Made the WEBrick adapter not use a mutex around action performance if ActionController::Base.allow_concurrency is true (default is false) * Fixed that mailer generator generated fixtures/plural while units expected fixtures/singular #1457 [Scott Barron] diff --git a/railties/lib/webrick_server.rb b/railties/lib/webrick_server.rb index 137c2570ca..71df5432e1 100644 --- a/railties/lib/webrick_server.rb +++ b/railties/lib/webrick_server.rb @@ -65,13 +65,13 @@ class DispatchServlet < WEBrick::HTTPServlet::AbstractServlet def service(req, res) begin unless handle_file(req, res) - REQUEST_MUTEX.lock unless RAILS_ENV == 'production' + REQUEST_MUTEX.lock unless ActionController::Base.allow_concurrency unless handle_dispatch(req, res) raise WEBrick::HTTPStatus::NotFound, "`#{req.path}' not found." end end ensure - unless RAILS_ENV == 'production' + unless ActionController::Base.allow_concurrency REQUEST_MUTEX.unlock if REQUEST_MUTEX.locked? end end |