diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
commit | b76ae638462ab0f673e5915986070518dd3f9ad3 (patch) | |
tree | bdab0533383b52873be0ec0eb4d3c66598ff8b91 /lib/gitlab/sidekiq_cluster | |
parent | 434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff) |
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
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 |