提交 b225693a 编写于 作者: J José Valim

Merge pull request #8559 from mshytikov/runner_method_is_slow_with_thread_safe

Attempt to fix slow runner name method
require 'thread_safe'
require 'active_support/concern'
require 'active_support/descendants_tracker'
require 'active_support/core_ext/class/attribute'
......@@ -351,10 +352,18 @@ def __reset_runner(symbol)
undef_method(name) if method_defined?(name)
end
def __callback_runner_name(kind)
def __callback_runner_name_cache
@__callback_runner_name_cache ||= ThreadSafe::Cache.new {|cache, kind| cache[kind] = __generate_callback_runner_name(kind) }
end
def __generate_callback_runner_name(kind)
"_run__#{self.name.hash.abs}__#{kind}__callbacks"
end
def __callback_runner_name(kind)
__callback_runner_name_cache[kind]
end
# This is used internally to append, prepend and skip callbacks to the
# CallbackChain.
def __update_callbacks(name, filters = [], block = nil) #:nodoc:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册