module DatabaseCleaner::OctopusSharding

Constants

VERSION

Public Instance Methods

clean_with_octopus() click to toggle source
# File lib/database_cleaner/octopus_sharding.rb, line 22
def clean_with_octopus
  if ::Octopus.enabled?
    each_shard do
      clean_without_octopus
    end
  else
    clean_without_octopus
  end
end
start_with_octopus() click to toggle source
# File lib/database_cleaner/octopus_sharding.rb, line 12
def start_with_octopus
  if ::Octopus.enabled?
    each_shard do
      start_without_octopus
    end
  else
    start_without_octopus
  end
end

Private Instance Methods

each_shard() { || ... } click to toggle source
# File lib/database_cleaner/octopus_sharding.rb, line 34
def each_shard
  ::ActiveRecord::Base.connection.instance_variable_get('@shards').each do |shard_name, _conn|
    Octopus.using(shard_name) do
      yield
    end
  end
end