提交 177a35e7 编写于 作者: J Joshua Peek

Added config.threadsafe! to toggle allow concurrency settings and disable the dependency loader

上级 ddd55250
*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 @@ def set_root_path!
::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.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册