diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-06 12:08:19 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-06 12:08:19 +0000 |
commit | eaf41d710dd1ee39125f9dce75812f0b6247adba (patch) | |
tree | 031a83beaea241474d5f2bdd5670961309cff000 /sidekiq_cluster | |
parent | 5bc6fcec0edaa4032afacce1aa5e5289e9ae07ac (diff) | |
download | gitlab-ce-eaf41d710dd1ee39125f9dce75812f0b6247adba.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'sidekiq_cluster')
-rw-r--r-- | sidekiq_cluster/cli.rb | 10 | ||||
-rw-r--r-- | sidekiq_cluster/sidekiq_cluster.rb | 8 |
2 files changed, 13 insertions, 5 deletions
diff --git a/sidekiq_cluster/cli.rb b/sidekiq_cluster/cli.rb index 341ebd9019a..760a5f14c2d 100644 --- a/sidekiq_cluster/cli.rb +++ b/sidekiq_cluster/cli.rb @@ -112,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, @@ -135,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. @@ -149,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 diff --git a/sidekiq_cluster/sidekiq_cluster.rb b/sidekiq_cluster/sidekiq_cluster.rb index 66fb5603d2b..1ed08e7e839 100644 --- a/sidekiq_cluster/sidekiq_cluster.rb +++ b/sidekiq_cluster/sidekiq_cluster.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require_relative '../lib/gitlab/process_management' +require_relative '../lib/gitlab/process_supervisor' module Gitlab module SidekiqCluster @@ -33,7 +34,8 @@ module Gitlab # # directory - The directory of the Rails application. # - # Returns an Array containing the PIDs of the started processes. + # Returns an Array containing the waiter threads (from Process.detach) of + # the started processes. def self.start(queues, env: :development, directory: Dir.pwd, max_concurrency: 20, min_concurrency: 0, timeout: DEFAULT_SOFT_TIMEOUT_SECONDS, dryrun: false) queues.map.with_index do |pair, index| start_sidekiq(pair, env: env, @@ -82,9 +84,7 @@ module Gitlab ) end - ProcessManagement.wait_async(pid) - - pid + Process.detach(pid) end def self.count_by_queue(queues) |