Skip to content

Commit

Permalink
Better fix for per-environment master shards
Browse files Browse the repository at this point in the history
I cowboyed up a bit too fast on the first fix.  This moves the
per-environment master_shard selection to its own yaml key
  • Loading branch information
calh committed Aug 28, 2019
1 parent a4d2a06 commit 1d07220
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/octopus.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,15 @@ def self.load_balancer
end

def self.master_shard
((config && ( config[rails_env][:master_shard] || config[:master_shard] )) || :master).to_sym
shard = :master
return shard unless config

if config[:master_shards] && config[:master_shards][rails_env]
shard = config[:master_shards][rails_env].to_sym
elsif config[:master_shard]
shard = config[:master_shard].to_sym
end
shard
end

# Public: Whether or not Octopus is configured and should hook into the
Expand Down

0 comments on commit 1d07220

Please sign in to comment.