diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-17 19:05:49 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-17 19:05:49 +0300 |
commit | 43a25d93ebdabea52f99b05e15b06250cd8f07d7 (patch) | |
tree | dceebdc68925362117480a5d672bcff122fb625b /sidekiq_cluster | |
parent | 20c84b99005abd1c82101dfeff264ac50d2df211 (diff) |
Add latest changes from gitlab-org/gitlab@16-0-stable-eev16.0.0-rc42
Diffstat (limited to 'sidekiq_cluster')
-rw-r--r-- | sidekiq_cluster/cli.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/sidekiq_cluster/cli.rb b/sidekiq_cluster/cli.rb index 23b05bf2d16..22cddead3e4 100644 --- a/sidekiq_cluster/cli.rb +++ b/sidekiq_cluster/cli.rb @@ -28,6 +28,11 @@ module Gitlab # The signals that should simply be forwarded to the workers. FORWARD_SIGNALS = %i(TTIN USR1 USR2 HUP).freeze + # The default queues that each Sidekiq process always listens to if routing rules are not customized: + # - `default` queue comes from config initializer's Settings.build_sidekiq_routing_rules + # - `mailers` queue comes from Gitlab::Application.config.action_mailer.deliver_later_queue_name + DEFAULT_QUEUES = %w[default mailers].freeze + CommandError = Class.new(StandardError) def initialize(log_output = $stderr) @@ -93,6 +98,26 @@ module Gitlab 'No queues found, you must select at least one queue' end + begin + routing_rules = ::Gitlab.config.sidekiq.routing_rules + rescue StandardError + routing_rules = [] + end + + # Routing rules are defaulted to [['*', 'default']] if not specified. + # This means all jobs go to 'default' queue and mailer jobs go to 'mailers' queue. + # See config/initializers/1_settings.rb and Settings.build_sidekiq_routing_rules. + # + # Now, in case queue_selector is used, we ensure all Sidekiq processes are still processing jobs + # from default and mailers queues. + # https://gitlab.com/gitlab-com/gl-infra/scalability/-/issues/1491 + if routing_rules.empty? + queue_groups.each do |queues| + queues.concat(DEFAULT_QUEUES) + queues.uniq! + end + end + if @list_queues puts queue_groups.map(&:sort) # rubocop:disable Rails/Output |