We have a Sidekiq background job that is really slow and db intensive,
we want to configure it to read from our Postgres follower database
of the standard one.
To do this I wrote a small utility class that connects an ActiveRecord
model to the follower db if it is not already connected.
Assume connected to follower if not connected to default connection
In the Sidekiq background job we use it like this:
SomeARClass.where(:some_id => id).some_scope(…)
Is this a good solution or does anyone have other suggestions for how to
We tried the Octopus gem but ran into a bug
(https://github.com/tchandy/octopus/issues/280) with it.
We also have another background job that we would like to switch over to
use the follower database but for another ActiveRecord model, is there
way to share the already established connection for another ActiveRecord
Any other feedback on this approach?