Class: ActiveRecord::AsynchronousQueriesTracker
Do not use. This class is for internal use only.
Relationships & Source Files | |
Namespace Children | |
Classes:
| |
Inherits: | Object |
Defined in: | activerecord/lib/active_record/asynchronous_queries_tracker.rb |
Class Method Summary
Instance Method Summary
Constructor Details
.new ⇒ AsynchronousQueriesTracker
# File 'activerecord/lib/active_record/asynchronous_queries_tracker.rb', line 45
def initialize @stack = [] end
Class Method Details
.complete(asynchronous_queries_tracker)
[ GitHub ]# File 'activerecord/lib/active_record/asynchronous_queries_tracker.rb', line 40
def complete(asynchronous_queries_tracker) asynchronous_queries_tracker.finalize_session end
.install_executor_hooks(executor = ActiveSupport::Executor)
[ GitHub ]# File 'activerecord/lib/active_record/asynchronous_queries_tracker.rb', line 32
def install_executor_hooks(executor = ActiveSupport::Executor) executor.register_hook(self) end
.run
[ GitHub ]# File 'activerecord/lib/active_record/asynchronous_queries_tracker.rb', line 36
def run ActiveRecord::Base.asynchronous_queries_tracker.tap(&:start_session) end
Instance Method Details
#current_session
[ GitHub ]# File 'activerecord/lib/active_record/asynchronous_queries_tracker.rb', line 49
def current_session @stack.last or raise ActiveRecordError, "Can't perform asynchronous queries without a query session" end
#finalize_session(wait = false)
[ GitHub ]# File 'activerecord/lib/active_record/asynchronous_queries_tracker.rb', line 58
def finalize_session(wait = false) session = @stack.pop session&.finalize(wait) self end