summaryrefslogtreecommitdiff
path: root/lib/system_check
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-03-08 18:09:12 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-03-08 18:09:12 +0000
commit0179dc40d71c2549d787d2f5fa7ba6dc6efae376 (patch)
tree9709db4077ec0f3f471e9b8094b0de67a3ab947c /lib/system_check
parent770d6dbfa7111324f994f12664a2036c7121602a (diff)
downloadgitlab-ce-0179dc40d71c2549d787d2f5fa7ba6dc6efae376.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/system_check')
-rw-r--r--lib/system_check/sidekiq_check.rb24
1 files changed, 15 insertions, 9 deletions
diff --git a/lib/system_check/sidekiq_check.rb b/lib/system_check/sidekiq_check.rb
index 4f1533a5b7d..7ac1bd58ede 100644
--- a/lib/system_check/sidekiq_check.rb
+++ b/lib/system_check/sidekiq_check.rb
@@ -15,7 +15,7 @@ module SystemCheck
def check_sidekiq_running
$stdout.print "Running? ... "
- if sidekiq_process_count > 0
+ if sidekiq_worker_process_count > 0
$stdout.puts "yes".color(:green)
else
$stdout.puts "no".color(:red)
@@ -31,15 +31,16 @@ module SystemCheck
end
def only_one_sidekiq_running
- process_count = sidekiq_process_count
- return if process_count == 0
+ worker_count = sidekiq_worker_process_count
+ cluster_count = sidekiq_cluster_process_count
+ return if worker_count == 0
- $stdout.print 'Number of Sidekiq processes ... '
+ $stdout.print 'Number of Sidekiq processes (cluster/worker) ... '
- if process_count == 1
- $stdout.puts '1'.color(:green)
+ if (cluster_count == 1 && worker_count > 0) || (cluster_count == 0 && worker_count == 1)
+ $stdout.puts "#{cluster_count}/#{worker_count}".color(:green)
else
- $stdout.puts "#{process_count}".color(:red)
+ $stdout.puts "#{cluster_count}/#{worker_count}".color(:red)
try_fixing_it(
'sudo service gitlab stop',
"sudo pkill -u #{gitlab_user} -f sidekiq",
@@ -50,9 +51,14 @@ module SystemCheck
end
end
- def sidekiq_process_count
+ def sidekiq_worker_process_count
ps_ux, _ = Gitlab::Popen.popen(%w(ps uxww))
- ps_ux.scan(/sidekiq \d+\.\d+\.\d+/).count
+ ps_ux.lines.grep(/sidekiq \d+\.\d+\.\d+/).count
+ end
+
+ def sidekiq_cluster_process_count
+ ps_ux, _ = Gitlab::Popen.popen(%w(ps uxww))
+ ps_ux.lines.grep(/sidekiq-cluster/).count
end
end
end