Commit 1073019d360e5aae6fd02efb3e9920a1a3658869

Authored by Dmitriy Zaporozhets
2 parents fdd64bf3 85123076

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

lib/support/init.d/gitlab
... ... @@ -218,9 +218,7 @@ reload(){
218 218 kill -USR2 "$wpid"
219 219 echo "Done."
220 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 222 # Waiting 2 seconds for sidekiq to write it.
225 223 sleep 2
226 224 status
... ...
lib/tasks/sidekiq.rake
... ... @@ -5,16 +5,28 @@ namespace :sidekiq do
5 5 end
6 6  
7 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 18 end
11 19  
12 20 desc "GITLAB | Start sidekiq with launchd on Mac OS X"
13 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 23 end
16 24  
17 25 def pidfile
18 26 Rails.root.join("tmp", "pids", "sidekiq.pid")
19 27 end
  28 +
  29 + def log_file
  30 + Rails.root.join("log", "sidekiq.log")
  31 + end
20 32 end
... ...