Skip to content
Snippets Groups Projects
Commit 4e9b02c3 authored by Robert Speicher's avatar Robert Speicher
Browse files

Merge branch 'sh-fix-sidekiq-throttling-init' into 'master'

Only turn on Sidekiq throttling if column exists

If the database has not been migrated properly, the initializer for Sidekiq will fail to start and cause the whole Rails server to crash. This change checks the existence for the column and allows Rails to start even if the setting has not been added as a database column.

Closes #24452

See merge request !7446
parents 0279ad5c 5a65d9d5
No related branches found
No related tags found
1 merge request!7446Only turn on Sidekiq throttling if column exists
Pipeline #
Loading
@@ -203,6 +203,10 @@ class ApplicationSetting < ActiveRecord::Base
Loading
@@ -203,6 +203,10 @@ class ApplicationSetting < ActiveRecord::Base
ActiveRecord::Base.connection.column_exists?(:application_settings, :home_page_url) ActiveRecord::Base.connection.column_exists?(:application_settings, :home_page_url)
end end
   
def sidekiq_throttling_column_exists?
ActiveRecord::Base.connection.column_exists?(:application_settings, :sidekiq_throttling_enabled)
end
def domain_whitelist_raw def domain_whitelist_raw
self.domain_whitelist.join("\n") unless self.domain_whitelist.nil? self.domain_whitelist.join("\n") unless self.domain_whitelist.nil?
end end
Loading
@@ -256,6 +260,12 @@ class ApplicationSetting < ActiveRecord::Base
Loading
@@ -256,6 +260,12 @@ class ApplicationSetting < ActiveRecord::Base
ensure_health_check_access_token! ensure_health_check_access_token!
end end
   
def sidekiq_throttling_enabled?
return false unless sidekiq_throttling_column_exists?
sidekiq_throttling_enabled
end
private private
   
def check_repository_storages def check_repository_storages
Loading
Loading
Loading
@@ -24,7 +24,7 @@ module Gitlab
Loading
@@ -24,7 +24,7 @@ module Gitlab
end end
   
def sidekiq_throttling_enabled? def sidekiq_throttling_enabled?
current_application_settings.sidekiq_throttling_enabled current_application_settings.sidekiq_throttling_enabled?
end end
   
def fake_application_settings def fake_application_settings
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment