Source: show | on GitHub
# File activerecord/lib/active_record/future_result.rb, line 6 def initialize(future_result, instrumenter) @future_result = future_result @instrumenter = instrumenter @events = [] end
# File activerecord/lib/active_record/future_result.rb, line 18 def flush events, @events = @events, [] events.each do |event| event.payload[:lock_wait] = @future_result.lock_wait ActiveSupport::Notifications.publish_event(event) end end
# File activerecord/lib/active_record/future_result.rb, line 12 def instrument(name, payload = {}, &block) event = @instrumenter.new_event(name, payload) @events << event event.record(&block) end