There might be ps utilities out there, that assume 80chars instead

of unlimited width if they cannot detect terminal size, therefore
force unlimited terminal size when checking processes via ps.
This commit is contained in:
Sebastian Reitenbach 2017-03-26 08:58:49 +02:00
parent c82ddfe24a
commit d8569440b5
3 changed files with 7 additions and 3 deletions

View File

@ -1,6 +1,6 @@
class Admin::BackgroundJobsController < Admin::ApplicationController class Admin::BackgroundJobsController < Admin::ApplicationController
def show def show
ps_output, _ = Gitlab::Popen.popen(%W(ps -U #{Gitlab.config.gitlab.user} -o pid,pcpu,pmem,stat,start,command)) ps_output, _ = Gitlab::Popen.popen(%W(ps ww -U #{Gitlab.config.gitlab.user} -o pid,pcpu,pmem,stat,start,command))
@sidekiq_processes = ps_output.split("\n").grep(/sidekiq/) @sidekiq_processes = ps_output.split("\n").grep(/sidekiq/)
@concurrency = Sidekiq.options[:concurrency] @concurrency = Sidekiq.options[:concurrency]
end end

View File

@ -0,0 +1,4 @@
---
title: Force unlimited terminal size when checking processes via call to ps
merge_request: 10246
author: Sebastian Reitenbach

View File

@ -617,7 +617,7 @@ namespace :gitlab do
end end
def sidekiq_process_count def sidekiq_process_count
ps_ux, _ = Gitlab::Popen.popen(%w(ps ux)) ps_ux, _ = Gitlab::Popen.popen(%w(ps uxww))
ps_ux.scan(/sidekiq \d+\.\d+\.\d+/).count ps_ux.scan(/sidekiq \d+\.\d+\.\d+/).count
end end
end end
@ -751,7 +751,7 @@ namespace :gitlab do
end end
def mail_room_running? def mail_room_running?
ps_ux, _ = Gitlab::Popen.popen(%w(ps ux)) ps_ux, _ = Gitlab::Popen.popen(%w(ps uxww))
ps_ux.include?("mail_room") ps_ux.include?("mail_room")
end end
end end