debian-mirror-gitlab/lib/gitlab/query_limiting/active_support_subscriber.rb

16 lines
341 B
Ruby
Raw Normal View History

2018-12-23 12:14:25 +05:30
# frozen_string_literal: true
2018-03-17 18:26:18 +05:30
module Gitlab
module QueryLimiting
class ActiveSupportSubscriber < ActiveSupport::Subscriber
attach_to :active_record
2018-03-27 19:54:05 +05:30
def sql(event)
2018-11-08 19:23:39 +05:30
unless event.payload.fetch(:cached, event.payload[:name] == 'CACHE')
2018-03-27 19:54:05 +05:30
Transaction.current&.increment
end
2018-03-17 18:26:18 +05:30
end
end
end
end