Handle missing settings table for metrics
This ensures we can still boot, even when the "application_settings" table doesn't exist.
This commit is contained in:
parent
af00558d38
commit
ed214a11ca
|
@ -9,12 +9,16 @@ module Gitlab
|
||||||
# etc). This ensures the application is able to boot up even when the
|
# etc). This ensures the application is able to boot up even when the
|
||||||
# migrations have not been executed.
|
# migrations have not been executed.
|
||||||
def self.settings
|
def self.settings
|
||||||
ApplicationSetting.current || {
|
if ApplicationSetting.table_exists? and curr = ApplicationSetting.current
|
||||||
metrics_pool_size: 16,
|
curr
|
||||||
metrics_timeout: 10,
|
else
|
||||||
metrics_enabled: false,
|
{
|
||||||
metrics_method_call_threshold: 10
|
metrics_pool_size: 16,
|
||||||
}
|
metrics_timeout: 10,
|
||||||
|
metrics_enabled: false,
|
||||||
|
metrics_method_call_threshold: 10
|
||||||
|
}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.pool_size
|
def self.pool_size
|
||||||
|
|
|
@ -29,7 +29,7 @@ describe Gitlab::Metrics do
|
||||||
it 'returns an Array containing a file path and line number' do
|
it 'returns an Array containing a file path and line number' do
|
||||||
file, line = described_class.last_relative_application_frame
|
file, line = described_class.last_relative_application_frame
|
||||||
|
|
||||||
expect(line).to eq(30)
|
expect(line).to eq(__LINE__ - 2)
|
||||||
expect(file).to eq('spec/lib/gitlab/metrics_spec.rb')
|
expect(file).to eq('spec/lib/gitlab/metrics_spec.rb')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue