lib/distribute_reads.rb in distribute_reads-0.3.5 vs lib/distribute_reads.rb in distribute_reads-0.4.0
- old
+ new
@@ -124,40 +124,32 @@
source = backtrace_cleaner.clean(caller.lazy).first
logger.info { " ↳ #{source}" } if source
end
end
- # private
def self.backtrace_cleaner
@backtrace_cleaner ||= begin
bc = ActiveSupport::BacktraceCleaner.new
bc.add_silencer { |line| line.include?("lib/distribute_reads") }
bc.add_silencer { |line| line.include?("lib/makara") }
bc.add_silencer { |line| line.include?("lib/active_record") }
bc
end
end
+ private_class_method :backtrace_cleaner
- # private
def self.with_replica
previous_value = Thread.current[:distribute_reads]
begin
Thread.current[:distribute_reads] = {replica: true, failover: false}
yield
ensure
Thread.current[:distribute_reads] = previous_value
end
end
+ private_class_method :with_replica
- # private
- def self.makara3?
- unless defined?(@makara3)
- @makara3 = Gem::Version.new(Makara::VERSION.to_s) < Gem::Version.new("0.4.0")
- end
- @makara3
- end
-
# legacy
def self.default_to_primary
!by_default
end
@@ -167,11 +159,10 @@
end
end
Makara::Proxy.prepend DistributeReads::AppropriatePool
Object.include DistributeReads::GlobalMethods
-# TODO uncomment in 0.4.0
-# Object.send :private, :distribute_reads
+Object.send :private, :distribute_reads
ActiveSupport.on_load(:active_job) do
require "distribute_reads/job_methods"
include DistributeReads::JobMethods
end