Skip to Content Skip to Search

class ActiveRecord::FutureResult::EventBuffer

Public class methods

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

Public instance methods

Source code GitHub
# 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
Source code GitHub
# 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

Definition files