diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-01 00:05:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-01 00:05:24 +0300 |
commit | c741c26fa0743e76c9331aa214ebe16559f1d2a6 (patch) | |
tree | 183d27ae527c89173872b4f9702bb64b3ac386a4 /config | |
parent | e9fe125578e745a7b18bed97eb3653bf5c0f4035 (diff) |
Add latest changes from gitlab-org/gitlab@12-7-stable-ee
Diffstat (limited to 'config')
-rw-r--r-- | config/initializers/attr_encrypted_thread_safe.rb | 17 | ||||
-rw-r--r-- | config/initializers/database_config.rb | 10 | ||||
-rw-r--r-- | config/initializers/geo.rb | 16 |
3 files changed, 31 insertions, 12 deletions
diff --git a/config/initializers/attr_encrypted_thread_safe.rb b/config/initializers/attr_encrypted_thread_safe.rb new file mode 100644 index 00000000000..be0bb56ffdc --- /dev/null +++ b/config/initializers/attr_encrypted_thread_safe.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +# As of v3.1.0, attr_encrypted is not thread-safe because all instances share the same `encrypted_attributes` +# This was fixed in https://github.com/attr-encrypted/attr_encrypted/commit/d4ca0e2073ca6ba5035997ce25f7fc0b4bfbe39e +# but no release was made after that so we have to patch it ourselves here + +module AttrEncrypted + module InstanceMethods + def encrypted_attributes + @encrypted_attributes ||= begin + duplicated = {} + self.class.encrypted_attributes.map { |key, value| duplicated[key] = value.dup } + duplicated + end + end + end +end diff --git a/config/initializers/database_config.rb b/config/initializers/database_config.rb index b5490fc4719..52897ad549d 100644 --- a/config/initializers/database_config.rb +++ b/config/initializers/database_config.rb @@ -10,6 +10,16 @@ def log_pool_size(db, previous_pool_size, current_pool_size) Gitlab::AppLogger.debug(log_message.join(' ')) end +Gitlab.ee do + # We need to initialize the Geo database before + # setting the Geo DB connection pool size. + if File.exist?(Rails.root.join('config/database_geo.yml')) + Rails.application.configure do + config.geo_database = config_for(:database_geo) + end + end +end + # When running on multi-threaded runtimes like Puma or Sidekiq, # set the number of threads per process as the minimum DB connection pool size. # This is to avoid connectivity issues as was documented here: diff --git a/config/initializers/geo.rb b/config/initializers/geo.rb index 4cc9fbf49b2..3278dc9e484 100644 --- a/config/initializers/geo.rb +++ b/config/initializers/geo.rb @@ -1,17 +1,9 @@ # frozen_string_literal: true Gitlab.ee do - if File.exist?(Rails.root.join('config/database_geo.yml')) - Rails.application.configure do - config.geo_database = config_for(:database_geo) - end - end - - begin - if Gitlab::Geo.connected? && Gitlab::Geo.primary? - Gitlab::Geo.current_node&.update_clone_url! - end - rescue => e - warn "WARNING: Unable to check/update clone_url_prefix for Geo: #{e}" + if Gitlab::Geo.connected? && Gitlab::Geo.primary? + Gitlab::Geo.current_node&.update_clone_url! end +rescue => e + warn "WARNING: Unable to check/update clone_url_prefix for Geo: #{e}" end |