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

runtime should be properly initialized.

上级 82c7ef83
......@@ -5,7 +5,7 @@ def self.runtime=(value)
end
def self.runtime
Thread.current["active_record_sql_runtime"]
Thread.current["active_record_sql_runtime"] ||= 0
end
def self.reset_runtime
......@@ -45,5 +45,4 @@ def logger
end
end
ActiveRecord::LogSubscriber.runtime = 0
ActiveRecord::LogSubscriber.attach_to :active_record
\ No newline at end of file
......@@ -57,4 +57,8 @@ def test_cached_queries_doesnt_log_when_level_is_not_debug
wait
assert_equal 0, @logger.logged(:debug).size
end
def test_initializes_runtime
Thread.new { assert_equal 0, ActiveRecord::LogSubscriber.runtime }.join
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册