Welcome to mirror list, hosted at ThFree Co, Russian Federation.

active_support_subscriber.rb « query_limiting « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 138fae7b64159405c19823ac8f318b58dcfa90df (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 !Transaction.current || event.payload.fetch(:cached, event.payload[:name] == 'CACHE')

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