Methods

Class Public methods

new(future_result, instrumenter)

# File activerecord/lib/active_record/future_result.rb, line 6
def initialize(future_result, instrumenter)
  @future_result = future_result
  @instrumenter = instrumenter
  @events = []
end

Instance Public methods

flush()

# 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

instrument(name, payload = {}, &block)

# 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