diff options
author | Rémy Coutable <remy@rymai.me> | 2019-04-10 12:03:37 +0200 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2019-04-10 15:56:46 +0200 |
commit | 22c1c9805b00ebc3bbb48fabba49cf2ba3e696e0 (patch) | |
tree | 642b04ecba8c0880ae8b36c99c95280ac9ff011f /app/models/application_setting.rb | |
parent | 6c8a13da33e5ff11210122f7863d36f989b99630 (diff) | |
download | gitlab-ce-22c1c9805b00ebc3bbb48fabba49cf2ba3e696e0.tar.gz |
Fix ApplicationSetting development seed60278-fix-development-seed
It could happen that there's a cached (in Redis) ApplicationSetting
record, and calling
`Gitlab::CurrentSettings.current_application_settings` only returns it
instead of creating a new DB record, which makes the
`ApplicationSetting.current_without_cache.update!` call fail.
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'app/models/application_setting.rb')
-rw-r--r-- | app/models/application_setting.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb index d28a12413bf..ee598812176 100644 --- a/app/models/application_setting.rb +++ b/app/models/application_setting.rb @@ -259,7 +259,9 @@ class ApplicationSetting < ApplicationRecord after_commit :expire_performance_bar_allowed_user_ids_cache, if: -> { previous_changes.key?('performance_bar_allowed_group_id') } def self.create_from_defaults - super + transaction(requires_new: true) do + super + end rescue ActiveRecord::RecordNotUnique # We already have an ApplicationSetting record, so just return it. current_without_cache |