Sha256: a7ae21619a9ccd113f81c0c86c75f66b10194ee6f05c85399253d7ecf645edaa

Contents?: true

Size: 514 Bytes

Versions: 2

Compression:

Stored size: 514 Bytes

Contents

module DistributeReads
  module AppropriatePool
    def _appropriate_pool(*args)
      if Thread.current[:distribute_reads]
        if needs_master?(*args) || @slave_pool.completely_blacklisted?
          stick_to_master(*args) unless DistributeReads.default_to_primary
          @master_pool
        elsif in_transaction?
          @master_pool
        else
          @slave_pool
        end
      elsif DistributeReads.default_to_primary
        @master_pool
      else
        super
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
distribute_reads-0.1.2 lib/distribute_reads/appropriate_pool.rb
distribute_reads-0.1.1 lib/distribute_reads/appropriate_pool.rb