Commit 6e089643 authored by Robert May's avatar Robert May Committed by Stan Hu

Fix for puma issue running via `rails s`

A recent update seems to have broken running the server locally
via `bundle exec rails s`. Puma no longer seems to respond to
`#cli_config` in that scenario, so this patch fixes that situation.
parent 9603ebdc
......@@ -16,7 +16,9 @@ module Gitlab
end
def running_puma_with_multiple_threads?
Gitlab::Runtime.puma? && ::Puma.cli_config.options[:max_threads] > 1
return false unless Gitlab::Runtime.puma?
::Puma.respond_to?(:cli_config) && ::Puma.cli_config.options[:max_threads] > 1
end
def execute_rugged_call(method_name, *args)
......
......@@ -122,6 +122,12 @@ describe Gitlab::Git::RuggedImpl::UseRugged, :seed_helper do
allow(Gitlab::Runtime).to receive(:puma?).and_return(true)
end
it "returns false when Puma doesn't support the cli_config method" do
allow(::Puma).to receive(:respond_to?).with(:cli_config).and_return(false)
expect(subject.running_puma_with_multiple_threads?).to be_falsey
end
it 'returns false for single thread Puma' do
allow(::Puma).to receive_message_chain(:cli_config, :options).and_return(max_threads: 1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment