diff options
Diffstat (limited to 'lib/gitlab/sidekiq_cluster')
-rw-r--r-- | lib/gitlab/sidekiq_cluster/cli.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/gitlab/sidekiq_cluster/cli.rb b/lib/gitlab/sidekiq_cluster/cli.rb index e20834fa912..05319ba17a2 100644 --- a/lib/gitlab/sidekiq_cluster/cli.rb +++ b/lib/gitlab/sidekiq_cluster/cli.rb @@ -37,6 +37,7 @@ module Gitlab @logger.formatter = ::Gitlab::SidekiqLogging::JSONFormatter.new @rails_path = Dir.pwd @dryrun = false + @list_queues = false end def run(argv = ARGV) @@ -47,6 +48,11 @@ module Gitlab option_parser.parse!(argv) + if @dryrun && @list_queues + raise CommandError, + 'The --dryrun and --list-queues options are mutually exclusive' + end + worker_metadatas = SidekiqConfig::CliMethods.worker_metadatas(@rails_path) worker_queues = SidekiqConfig::CliMethods.worker_queues(@rails_path) @@ -73,6 +79,12 @@ module Gitlab 'No queues found, you must select at least one queue' end + if @list_queues + puts queue_groups.map(&:sort) # rubocop:disable Rails/Output + + return + end + unless @dryrun @logger.info("Starting cluster with #{queue_groups.length} processes") end @@ -202,6 +214,10 @@ module Gitlab opt.on('-d', '--dryrun', 'Print commands that would be run without this flag, and quit') do |int| @dryrun = true end + + opt.on('--list-queues', 'List matching queues, and quit') do |int| + @list_queues = true + end end end end |