Commit 318f96a40d8b657494bc5b8008c02e8cc0162fd4
Exists in
master
and in
4 other branches
Merge branch 'fix_sidekiq_process_count' of /home/git/repositories/gitlab/gitlabhq
Showing
1 changed file
with
7 additions
and
7 deletions
Show diff stats
lib/tasks/gitlab/check.rake
| ... | ... | @@ -643,7 +643,7 @@ namespace :gitlab do |
| 643 | 643 | def check_sidekiq_running |
| 644 | 644 | print "Running? ... " |
| 645 | 645 | |
| 646 | - if sidekiq_process_match | |
| 646 | + if sidekiq_process_count > 0 | |
| 647 | 647 | puts "yes".green |
| 648 | 648 | else |
| 649 | 649 | puts "no".red |
| ... | ... | @@ -659,14 +659,14 @@ namespace :gitlab do |
| 659 | 659 | end |
| 660 | 660 | |
| 661 | 661 | def only_one_sidekiq_running |
| 662 | - sidekiq_match = sidekiq_process_match | |
| 663 | - return unless sidekiq_match | |
| 662 | + process_count = sidekiq_process_count | |
| 663 | + return if process_count.zero? | |
| 664 | 664 | |
| 665 | 665 | print 'Number of Sidekiq processes ... ' |
| 666 | - if sidekiq_match.length == 1 | |
| 666 | + if process_count == 1 | |
| 667 | 667 | puts '1'.green |
| 668 | 668 | else |
| 669 | - puts "#{sidekiq_match.length}".red | |
| 669 | + puts "#{process_count}".red | |
| 670 | 670 | try_fixing_it( |
| 671 | 671 | 'sudo service gitlab stop', |
| 672 | 672 | "sudo pkill -u #{gitlab_user} -f sidekiq", |
| ... | ... | @@ -677,8 +677,8 @@ namespace :gitlab do |
| 677 | 677 | end |
| 678 | 678 | end |
| 679 | 679 | |
| 680 | - def sidekiq_process_match | |
| 681 | - run_and_match("ps ux | grep -i sidekiq | grep -v grep", /(sidekiq \d+\.\d+\.\d+.+$)/) | |
| 680 | + def sidekiq_process_count | |
| 681 | + `ps ux`.scan(/sidekiq \d+\.\d+\.\d+/).count | |
| 682 | 682 | end |
| 683 | 683 | end |
| 684 | 684 | ... | ... |