Commit 1073019d360e5aae6fd02efb3e9920a1a3658869
Exists in
master
and in
4 other branches
Merge branch 'sidekiq_restart' of /home/git/repositories/gitlab/gitlabhq
Showing
2 changed files
with
16 additions
and
6 deletions
Show diff stats
lib/support/init.d/gitlab
| @@ -218,9 +218,7 @@ reload(){ | @@ -218,9 +218,7 @@ reload(){ | ||
| 218 | kill -USR2 "$wpid" | 218 | kill -USR2 "$wpid" |
| 219 | echo "Done." | 219 | echo "Done." |
| 220 | echo "Restarting GitLab Sidekiq since it isn't capable of reloading its config..." | 220 | echo "Restarting GitLab Sidekiq since it isn't capable of reloading its config..." |
| 221 | - RAILS_ENV=$RAILS_ENV bundle exec rake sidekiq:stop | ||
| 222 | - echo "Starting Sidekiq..." | ||
| 223 | - RAILS_ENV=$RAILS_ENV bundle exec rake sidekiq:start | 221 | + RAILS_ENV=$RAILS_ENV bundle exec rake sidekiq:restart |
| 224 | # Waiting 2 seconds for sidekiq to write it. | 222 | # Waiting 2 seconds for sidekiq to write it. |
| 225 | sleep 2 | 223 | sleep 2 |
| 226 | status | 224 | status |
lib/tasks/sidekiq.rake
| @@ -5,16 +5,28 @@ namespace :sidekiq do | @@ -5,16 +5,28 @@ namespace :sidekiq do | ||
| 5 | end | 5 | end |
| 6 | 6 | ||
| 7 | desc "GITLAB | Start sidekiq" | 7 | desc "GITLAB | Start sidekiq" |
| 8 | - task :start do | ||
| 9 | - system "nohup bundle exec sidekiq -q post_receive,mailer,system_hook,project_web_hook,gitlab_shell,common,default -e #{Rails.env} -P #{pidfile} >> #{Rails.root.join("log", "sidekiq.log")} 2>&1 &" | 8 | + task :start => :restart |
| 9 | + | ||
| 10 | + desc 'GitLab | Restart sidekiq' | ||
| 11 | + task :restart do | ||
| 12 | + if File.exist?(pidfile) | ||
| 13 | + puts 'Shutting down existing sidekiq process.' | ||
| 14 | + Rake::Task['sidekiq:stop'].invoke | ||
| 15 | + puts 'Starting new sidekiq process.' | ||
| 16 | + end | ||
| 17 | + system "bundle exec sidekiq -q post_receive,mailer,system_hook,project_web_hook,gitlab_shell,common,default -e #{Rails.env} -P #{pidfile} -d -L #{log_file} >> #{log_file} 2>&1" | ||
| 10 | end | 18 | end |
| 11 | 19 | ||
| 12 | desc "GITLAB | Start sidekiq with launchd on Mac OS X" | 20 | desc "GITLAB | Start sidekiq with launchd on Mac OS X" |
| 13 | task :launchd do | 21 | task :launchd do |
| 14 | - system "bundle exec sidekiq -q post_receive,mailer,system_hook,project_web_hook,gitlab_shell,common,default -e #{Rails.env} -P #{pidfile} >> #{Rails.root.join("log", "sidekiq.log")} 2>&1" | 22 | + system "bundle exec sidekiq -q post_receive,mailer,system_hook,project_web_hook,gitlab_shell,common,default -e #{Rails.env} -P #{pidfile} >> #{log_file} 2>&1" |
| 15 | end | 23 | end |
| 16 | 24 | ||
| 17 | def pidfile | 25 | def pidfile |
| 18 | Rails.root.join("tmp", "pids", "sidekiq.pid") | 26 | Rails.root.join("tmp", "pids", "sidekiq.pid") |
| 19 | end | 27 | end |
| 28 | + | ||
| 29 | + def log_file | ||
| 30 | + Rails.root.join("log", "sidekiq.log") | ||
| 31 | + end | ||
| 20 | end | 32 | end |