Class: ActiveRecord::ConnectionAdapters::TransactionInstrumenter

Inherits:
Object
  • Object
show all
Defined in:
lib/active_record/connection_adapters/abstract/transaction.rb

Instance Method Summary collapse

Constructor Details

#initialize(payload = {}) ⇒ TransactionInstrumenter

Returns a new instance of TransactionInstrumenter.



78
79
80
81
82
# File 'lib/active_record/connection_adapters/abstract/transaction.rb', line 78

def initialize(payload = {})
  @handle = nil
  @started = false
  @payload = payload
end

Instance Method Details

#finishObject



92
93
94
95
96
97
# File 'lib/active_record/connection_adapters/abstract/transaction.rb', line 92

def finish
  return unless @started
  @started = false

  @handle.finish
end

#startObject



84
85
86
87
88
89
90
# File 'lib/active_record/connection_adapters/abstract/transaction.rb', line 84

def start
  return if @started
  @started = true

  @handle = ActiveSupport::Notifications.instrumenter.build_handle("transaction.active_record", @payload)
  @handle.start
end