diff options
Diffstat (limited to 'lib/gitlab/runtime.rb')
-rw-r--r-- | lib/gitlab/runtime.rb | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/lib/gitlab/runtime.rb b/lib/gitlab/runtime.rb index 64ab020a30e..182c13980e6 100644 --- a/lib/gitlab/runtime.rb +++ b/lib/gitlab/runtime.rb @@ -8,15 +8,19 @@ module Gitlab AmbiguousProcessError = Class.new(IdentificationError) UnknownProcessError = Class.new(IdentificationError) + AVAILABLE_RUNTIMES = [ + :console, + :geo_log_cursor, + :puma, + :rake, + :sidekiq, + :test_suite, + :unicorn + ].freeze + class << self def identify - matches = [] - matches << :puma if puma? - matches << :unicorn if unicorn? - matches << :console if console? - matches << :sidekiq if sidekiq? - matches << :rake if rake? - matches << :test_suite if test_suite? + matches = AVAILABLE_RUNTIMES.select { |runtime| public_send("#{runtime}?") } # rubocop:disable GitlabSecurity/PublicSend if matches.one? matches.first @@ -56,6 +60,10 @@ module Gitlab !!defined?(::Rails::Console) end + def geo_log_cursor? + !!defined?(::GeoLogCursorOptionParser) + end + def web_server? puma? || unicorn? end |