diff options
author | Rémy Coutable <remy@rymai.me> | 2017-02-22 16:29:38 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-02-22 16:29:38 +0000 |
commit | 15b7bc624b89ebb6b98b0f03801d68ea6a480b82 (patch) | |
tree | 1ba7a67ff5857783c3761cc601c5418309821f0a /lib | |
parent | 475715f18f03ff059618b42b3ecdf162cb419403 (diff) | |
parent | cf521c95761540f273804d23a1150dbb0af4e63b (diff) | |
download | gitlab-ce-15b7bc624b89ebb6b98b0f03801d68ea6a480b82.tar.gz |
Merge branch 'connection-pool-host' into 'master'
Allow setting of a custom connection pool host
See merge request !9445
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/database.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/gitlab/database.rb b/lib/gitlab/database.rb index a47d7e98a62..d160cadc2d0 100644 --- a/lib/gitlab/database.rb +++ b/lib/gitlab/database.rb @@ -79,11 +79,16 @@ module Gitlab end end - def self.create_connection_pool(pool_size) + # pool_size - The size of the DB pool. + # host - An optional host name to use instead of the default one. + def self.create_connection_pool(pool_size, host = nil) # See activerecord-4.2.7.1/lib/active_record/connection_adapters/connection_specification.rb env = Rails.env original_config = ActiveRecord::Base.configurations + env_config = original_config[env].merge('pool' => pool_size) + env_config['host'] = host if host + config = original_config.merge(env => env_config) spec = |