Methods
Class Public methods
new(future_result, instrumenter)
📝 Source code
# File activerecord/lib/active_record/future_result.rb, line 27
def initialize(future_result, instrumenter)
@future_result = future_result
@instrumenter = instrumenter
@events = []
end
🔎 See on GitHub
Instance Public methods
flush()
📝 Source code
# File activerecord/lib/active_record/future_result.rb, line 42
def flush
events, @events = @events, []
events.each do |event|
event.payload[:lock_wait] = @future_result.lock_wait
ActiveSupport::Notifications.publish_event(event)
end
end
🔎 See on GitHub
instrument(name, payload = {}, &block)
📝 Source code
# File activerecord/lib/active_record/future_result.rb, line 33
def instrument(name, payload = {}, &block)
event = @instrumenter.new_event(name, payload)
begin
event.record(&block)
ensure
@events << event
end
end
🔎 See on GitHub