mirror of https://github.com/rails/rails
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
This commit is contained in:
parent
413d10ceec
commit
0c3298f2f2
|
@ -1,5 +1,7 @@
|
|||
*SVN*
|
||||
|
||||
* 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.
|
||||
|
||||
* Added TextHelper#word_wrap(text, line_length = 80) #1449 [tuxie@dekadance.se]
|
||||
|
||||
* Added a fall-through action for form_remote_tag that'll be used in case Javascript is unavailable #1459 [Scott Barron]. Example:
|
||||
|
|
|
@ -228,6 +228,12 @@ module ActionController #:nodoc:
|
|||
@@debug_routes = true
|
||||
cattr_accessor :debug_routes
|
||||
|
||||
# Controls 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.
|
||||
@@allow_concurrency = false
|
||||
cattr_accessor :allow_concurrency
|
||||
|
||||
# Template root determines the base from which template references will be made. So a call to render("test/template")
|
||||
# will be converted to "#{template_root}/test/template.rhtml".
|
||||
class_inheritable_accessor :template_root
|
||||
|
|
|
@ -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]
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue