Class: ActiveRecord::ConnectionAdapters::QueryIntent::EventBuffer
| Relationships & Source Files | |
| Inherits: | Object |
| Defined in: | activerecord/lib/active_record/connection_adapters/query_intent.rb |
Overview
Buffers instrumentation events during background execution for later publishing
Class Method Summary
- .new(intent, instrumenter) ⇒ EventBuffer constructor
Instance Method Summary
Constructor Details
.new(intent, instrumenter) ⇒ EventBuffer
# File 'activerecord/lib/active_record/connection_adapters/query_intent.rb', line 8
def initialize(intent, instrumenter) @intent = intent @instrumenter = instrumenter @events = [] end
Instance Method Details
#flush
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/query_intent.rb', line 23
def flush events, @events = @events, [] events.each do |event| event.payload[:lock_wait] = @intent.lock_wait ActiveSupport::Notifications.publish_event(event) end end