diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-30 12:06:34 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-30 12:06:34 +0000 |
commit | 228d752ff09362002cc904d28edee7d63cc3cef2 (patch) | |
tree | 63e7ff466c0b0794f67c87c34e874f8682fb5de0 /config | |
parent | b539ac1d619c0aafe5988ab8b125a8b43b14d87f (diff) | |
download | gitlab-ce-228d752ff09362002cc904d28edee7d63cc3cef2.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'config')
-rw-r--r-- | config/initializers/database_config.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/config/initializers/database_config.rb b/config/initializers/database_config.rb new file mode 100644 index 00000000000..d8c2821066b --- /dev/null +++ b/config/initializers/database_config.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# when running on puma, scale connection pool size with the number +# of threads per worker process +if defined?(::Puma) + db_config = Gitlab::Database.config || + Rails.application.config.database_configuration[Rails.env] + puma_options = Puma.cli_config.options + + # We use either the maximum number of threads per worker process, or + # the user specified value, whichever is larger. + desired_pool_size = [db_config['pool'].to_i, puma_options[:max_threads]].max + + db_config['pool'] = desired_pool_size + + # recreate the connection pool from the new config + ActiveRecord::Base.establish_connection(db_config) +end |