octopus
octopus copied to clipboard
When running `using_all`, is there any way to get which instance we're on?
The setup: I have multiple databases of the same schema. Each database represent the data for different sites. I want to iterate through each of the instances and print out the user count along with the shard name. How can I do that?
This is the code I have so far:
Octopus.using_all do
users = User.all
ap @shard # This doesn't work
ap users.length
end
What about User.connection.current_shard
?