Skip to content

Commit 1073019

Browse files
committed
Merge branch 'sidekiq_restart' of /home/git/repositories/gitlab/gitlabhq
2 parents fdd64bf + 8512307 commit 1073019

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

lib/support/init.d/gitlab

+1-3
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,7 @@ reload(){
218218
kill -USR2 "$wpid"
219219
echo "Done."
220220
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
224222
# Waiting 2 seconds for sidekiq to write it.
225223
sleep 2
226224
status

lib/tasks/sidekiq.rake

+15-3
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,28 @@ namespace :sidekiq do
55
end
66

77
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"
1018
end
1119

1220
desc "GITLAB | Start sidekiq with launchd on Mac OS X"
1321
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"
1523
end
1624

1725
def pidfile
1826
Rails.root.join("tmp", "pids", "sidekiq.pid")
1927
end
28+
29+
def log_file
30+
Rails.root.join("log", "sidekiq.log")
31+
end
2032
end

0 commit comments

Comments
 (0)