Reputation: 7225
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.
Upvotes: 0
Views: 448
Reputation: 2450
This was answered in comments:
This can be confirmed by logging in to (in this case) mysql and running
show processlist
Upvotes: 0