I have a model and in which i use establish_connection
to connect to different database(let name it remote database
) of other application.
example:
class User < ActiveRecord::Base
establish_connection(some_database_credential_hash)
self.class_name = "members"
end
and in production environment i am running a rake task which uses User class
in it.My question is that if the same rake task runs every hour, will it try to make new connection every time to new members table of remote database increasing load and pool on that database? if Yes, how can i avoid it? Please suggest.