Class: Gitlab::QueryLimiting::ActiveSupportSubscriber

Inherits:
ActiveSupport::Subscriber
  • Object
show all
Defined in:
lib/gitlab/query_limiting/active_support_subscriber.rb

Instance Method Summary collapse

Instance Method Details

#sql(event) ⇒ Object


8
9
10
11
12
13
# File 'lib/gitlab/query_limiting/active_support_subscriber.rb', line 8

def sql(event)
  return if !::Gitlab::QueryLimiting::Transaction.current || event.payload.fetch(:cached, event.payload[:name] == 'CACHE')

  ::Gitlab::QueryLimiting::Transaction.current.increment(event.payload[:sql])
  ::Gitlab::QueryLimiting::Transaction.current.executed_sql(event.payload[:sql])
end