Class: Sequel::SchemaSharding::ConnectionStrategy::PrimaryWithFailover

Inherits:
Object
  • Object
show all
Defined in:
lib/sequel/schema-sharding/connection_strategies/primary_with_failover.rb

Class Method Summary collapse

Class Method Details

.choose(db, config) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/sequel/schema-sharding/connection_strategies/primary_with_failover.rb', line 11

def self.choose(db, config)
  if db.pool.failing_over?
    config['replicas'][1..-1].sample
  else
    config['replicas'].first
  end
end