mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Added config.threadsafe! to toggle allow concurrency settings and disable the dependency loader
This commit is contained in:
parent
ddd552504b
commit
177a35e711
3 changed files with 17 additions and 0 deletions
|
@ -1,5 +1,7 @@
|
|||
*Edge*
|
||||
|
||||
* Added config.threadsafe! to toggle allow concurrency settings and disable the dependency loader [Josh Peek]
|
||||
|
||||
* Turn cache_classes on by default [Josh Peek]
|
||||
|
||||
* Added configurable eager load paths. Defaults to app/models, app/controllers, and app/helpers [Josh Peek]
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
# Code is not reloaded between requests
|
||||
config.cache_classes = true
|
||||
|
||||
# Enable threaded mode
|
||||
# config.threadsafe!
|
||||
|
||||
# Use a different logger for distributed setups
|
||||
# config.logger = SyslogLogger.new
|
||||
|
||||
|
|
|
@ -768,6 +768,18 @@ Run `rake gems:install` to install the missing gems.
|
|||
::RAILS_ROOT.replace @root_path
|
||||
end
|
||||
|
||||
# Enable threaded mode. Allows concurrent requests to controller actions and
|
||||
# multiple database connections. Also disables automatic dependency loading
|
||||
# after boot
|
||||
def threadsafe!
|
||||
self.cache_classes = true
|
||||
self.dependency_loading = false
|
||||
self.active_record.allow_concurrency = true
|
||||
self.action_controller.allow_concurrency = true
|
||||
self.to_prepare { Rails.cache.threadsafe! }
|
||||
self
|
||||
end
|
||||
|
||||
# Loads and returns the contents of the #database_configuration_file. The
|
||||
# contents of the file are processed via ERB before being sent through
|
||||
# YAML::load.
|
||||
|
|
Loading…
Reference in a new issue