Hi,
If you’re running in a separate thread, normally you would wrap any code accessing the database was ActiveRecord::Base.connection_pool.with_connection
.
When you’re using horizontal sharding, does the ActiveRecord::Base.connected_to(shard: :foo, role: :reading)
implicilty checkout a connection from the connection pool, or do you need to include the with_connection
call?
If you do need to include the with_connection
call, do you do that inside the connected_to
block, or outside?