lib/toaster/util/config.rb in cloud-toaster-1.1.5 vs lib/toaster/util/config.rb in cloud-toaster-1.1.6

- old
+ new

@@ -42,10 +42,13 @@ end v[last_key] end def self.init_db_connection(config=nil) + if $db_connection_initialized + return + end require "toaster/util/util" if !config || !config["mysql"] config = { "db_type" => "mysql", 'mysql' => Config.get('db') @@ -57,11 +60,13 @@ ActiveRecord::Base.establish_connection( :adapter => 'mysql2', :host => "#{config["mysql"]["host"]}".empty? ? get("db.host") : config["mysql"]["host"], :database => "#{config["mysql"]["database"]}".empty? ? get("db.database") : config["mysql"]["database"], :username => "#{config["mysql"]["username"]}".empty? ? get("db.username") : config["mysql"]["username"], - :password => "#{config["mysql"]["password"]}".empty? ? get("db.password") : config["mysql"]["password"] + :password => "#{config["mysql"]["password"]}".empty? ? get("db.password") : config["mysql"]["password"], + :pool => 50 # connection pool size limit (default is 5 which is not sufficient) ) + $db_connection_initialized = true else puts "WARN: Incorrect database connection configuration" end end