blob: 49f76ce78149107da56456cbd955c984e83878b8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
# frozen_string_literal: true
module Gitlab
module QueryLimiting
class ActiveSupportSubscriber < ActiveSupport::Subscriber
attach_to :active_record
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
end
end
end
|