Commit 13e073e45be6b3c9357ffbb45e843782b9be79d9

Authored by Dmitriy Zaporozhets
2 parents 052a7cc9 1a9b0df7

Merge branch 'only_one_sidekiq' of /home/git/repositories/gitlab/gitlabhq

Showing 1 changed file with 26 additions and 1 deletions   Show diff stats
lib/tasks/gitlab/check.rake
... ... @@ -626,6 +626,7 @@ namespace :gitlab do
626 626 start_checking "Sidekiq"
627 627  
628 628 check_sidekiq_running
  629 + only_one_sidekiq_running
629 630  
630 631 finished_checking "Sidekiq"
631 632 end
... ... @@ -637,7 +638,7 @@ namespace :gitlab do
637 638 def check_sidekiq_running
638 639 print "Running? ... "
639 640  
640   - if run_and_match("ps aux | grep -i sidekiq", /sidekiq \d+\.\d+\.\d+.+$/)
  641 + if sidekiq_process_match
641 642 puts "yes".green
642 643 else
643 644 puts "no".red
... ... @@ -651,6 +652,30 @@ namespace :gitlab do
651 652 fix_and_rerun
652 653 end
653 654 end
  655 +
  656 + def only_one_sidekiq_running
  657 + sidekiq_match = sidekiq_process_match
  658 + return unless sidekiq_match
  659 +
  660 + print 'Number of Sidekiq processes ... '
  661 + if sidekiq_match.length == 1
  662 + puts '1'.green
  663 + else
  664 + puts "#{sidekiq_match.length}".red
  665 + try_fixing_it(
  666 + 'Unless you are running another Rails application on this server there should only be one Sidekiq process.',
  667 + 'sudo service gitlab stop',
  668 + 'sudo pkill -f sidekiq',
  669 + 'sleep 10 && sudo pkill -9 -f sidekiq',
  670 + 'sudo service gitlab start'
  671 + )
  672 + fix_and_rerun
  673 + end
  674 + end
  675 +
  676 + def sidekiq_process_match
  677 + run_and_match("ps aux | grep -i sidekiq", /(sidekiq \d+\.\d+\.\d+.+$)/)
  678 + end
654 679 end
655 680  
656 681  
... ...