Module: ActiveRecord::Railties::ControllerRuntime
Do not use. This module is for internal use only.
Relationships & Source Files | |
Namespace Children | |
Modules:
| |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
::ActiveSupport::Concern
|
|
Defined in: | activerecord/lib/active_record/railties/controller_runtime.rb |
Class Method Summary
::ActiveSupport::Concern
- Extended
class_methods | Define class methods from given block. |
included | Evaluate given block in context of base class, so that you can write class macros here. |
prepended | Evaluate given block in context of base class, so that you can write class macros here. |
append_features, prepend_features |
Instance Attribute Summary
- #db_runtime rw private
Instance Method Summary
- #initialize
- #append_info_to_payload(payload) private
- #cleanup_view_runtime private
- #process_action(action, *args) private
Instance Attribute Details
#db_runtime (rw, private)
[ GitHub ]# File 'activerecord/lib/active_record/railties/controller_runtime.rb', line 32
attr_internal :db_runtime
Instance Method Details
#append_info_to_payload(payload) (private)
[ GitHub ]# File 'activerecord/lib/active_record/railties/controller_runtime.rb', line 59
def append_info_to_payload(payload) super runtime_stats = ActiveRecord::RuntimeRegistry.stats payload[:db_runtime] = (db_runtime || 0) + runtime_stats.sql_runtime payload[:queries_count] = runtime_stats.queries_count payload[:cached_queries_count] = runtime_stats.cached_queries_count runtime_stats.reset end
#cleanup_view_runtime (private)
[ GitHub ]# File 'activerecord/lib/active_record/railties/controller_runtime.rb', line 42
def cleanup_view_runtime if logger && logger.info? runtime_stats = ActiveRecord::RuntimeRegistry.stats db_rt_before_render = runtime_stats.reset_runtimes self.db_runtime = (db_runtime || 0) + db_rt_before_render runtime = super queries_rt = runtime_stats.sql_runtime - runtime_stats.async_sql_runtime db_rt_after_render = runtime_stats.reset_runtimes self.db_runtime += db_rt_after_render runtime - queries_rt else super end end
#initialize
[ GitHub ]# File 'activerecord/lib/active_record/railties/controller_runtime.rb', line 26
def initialize(...) # :nodoc: super self.db_runtime = nil end
#process_action(action, *args) (private)
[ GitHub ]# File 'activerecord/lib/active_record/railties/controller_runtime.rb', line 34
def process_action(action, *args) # We also need to reset the runtime before each action # because of queries in middleware or in cases we are streaming # and it won't be cleaned up by the method below. ActiveRecord::RuntimeRegistry.reset super end