跳至内容 跳至搜索
方法
F
I
N

类公有方法

new(future_result, instrumenter)

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

实例公有方法

flush()

# 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

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

# 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