Module: ElasticRecord::Railties::ControllerRuntime
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/elastic_record/railties/controller_runtime.rb
Overview
:nodoc:
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #append_info_to_payload(payload) ⇒ Object
- #cleanup_view_runtime ⇒ Object
- #process_action(action, *args) ⇒ Object
Instance Method Details
#append_info_to_payload(payload) ⇒ Object
39 40 41 42 |
# File 'lib/elastic_record/railties/controller_runtime.rb', line 39 def append_info_to_payload(payload) super payload[:elastic_record_runtime] = (elastic_record_runtime || 0) + ElasticRecord::LogSubscriber.reset_runtime end |
#cleanup_view_runtime ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/elastic_record/railties/controller_runtime.rb', line 31 def cleanup_view_runtime runtime_before_render = ElasticRecord::LogSubscriber.reset_runtime runtime = super runtime_after_render = ElasticRecord::LogSubscriber.reset_runtime self.elastic_record_runtime = runtime_before_render + runtime_after_render runtime - runtime_after_render end |
#process_action(action, *args) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/elastic_record/railties/controller_runtime.rb', line 23 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. ElasticRecord::LogSubscriber.reset_runtime super end |