summaryrefslogtreecommitdiff
path: root/sidekiq_cluster/cli.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-12-20 14:22:11 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-12-20 14:22:11 +0000
commit0c872e02b2c822e3397515ec324051ff540f0cd5 (patch)
treece2fb6ce7030e4dad0f4118d21ab6453e5938cdd /sidekiq_cluster/cli.rb
parentf7e05a6853b12f02911494c4b3fe53d9540d74fc (diff)
downloadgitlab-ce-0c872e02b2c822e3397515ec324051ff540f0cd5.tar.gz
Add latest changes from gitlab-org/gitlab@15-7-stable-eev15.7.0-rc42
Diffstat (limited to 'sidekiq_cluster/cli.rb')
-rw-r--r--sidekiq_cluster/cli.rb15
1 files changed, 12 insertions, 3 deletions
diff --git a/sidekiq_cluster/cli.rb b/sidekiq_cluster/cli.rb
index 52dc14130fb..760a5f14c2d 100644
--- a/sidekiq_cluster/cli.rb
+++ b/sidekiq_cluster/cli.rb
@@ -31,8 +31,9 @@ module Gitlab
CommandError = Class.new(StandardError)
def initialize(log_output = $stderr)
- # As recommended by https://github.com/mperham/sidekiq/wiki/Advanced-Options#concurrency
- @max_concurrency = 50
+ # https://github.com/mperham/sidekiq/wiki/Advanced-Options#concurrency
+ # https://ruby.social/@getajobmike/109326475545816363
+ @max_concurrency = 20
@min_concurrency = 0
@environment = ENV['RAILS_ENV'] || 'development'
@metrics_dir = ENV["prometheus_multiproc_dir"] || File.absolute_path("tmp/prometheus_multiproc_dir/sidekiq")
@@ -111,7 +112,7 @@ module Gitlab
end
def start_and_supervise_workers(queue_groups)
- worker_pids = SidekiqCluster.start(
+ wait_threads = SidekiqCluster.start(
queue_groups,
env: @environment,
directory: @rails_path,
@@ -134,6 +135,7 @@ module Gitlab
)
metrics_server_pid = start_metrics_server
+ worker_pids = wait_threads.map(&:pid)
supervisor.supervise(worker_pids + Array(metrics_server_pid)) do |dead_pids|
# If we're not in the process of shutting down the cluster,
# and the metrics server died, restart it.
@@ -148,6 +150,13 @@ module Gitlab
[]
end
end
+
+ exit_statuses = wait_threads.map do |thread|
+ thread.join
+ thread.value
+ end
+
+ exit 1 unless exit_statuses.compact.all?(&:success?)
end
def start_metrics_server