Class: Dblint::Checks::LongHeldLock

Inherits:
Base
  • Object
show all
Defined in:
lib/dblint/checks/long_held_lock.rb

Defined Under Namespace

Classes: Error

Instance Method Summary collapse

Methods inherited from Base

#check_name, #config, #find_main_app_caller, #ignored?

Constructor Details

#initializeLongHeldLock

Returns a new instance of LongHeldLock.



6
7
8
9
# File 'lib/dblint/checks/long_held_lock.rb', line 6

def initialize
  @locks_held = {}
  @existing_ids = {}
end

Instance Method Details

#statement_finished(_name, _id, payload) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/dblint/checks/long_held_lock.rb', line 15

def statement_finished(_name, _id, payload)
  if payload[:sql] == 'BEGIN'
    handle_begin
  elsif payload[:sql] == 'COMMIT'
    handle_commit
  elsif payload[:sql] == 'ROLLBACK'
    # do nothing
  elsif @existing_ids.present?
    increment_locks_held
    add_new_locks_held(payload)
  end
end

#statement_started(_name, _id, _payload) ⇒ Object



11
12
13
# File 'lib/dblint/checks/long_held_lock.rb', line 11

def statement_started(_name, _id, _payload)
  # Ignored
end