Skip to content

Commit

Permalink
cronjob to restart sidekiq workers daily, might help with the memoryo…
Browse files Browse the repository at this point in the history
…verflow
  • Loading branch information
Lennart Prelle committed Aug 11, 2014
1 parent 6ef6241 commit 4b59a36
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
14 changes: 14 additions & 0 deletions config/schedule.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
num_sidekiq_workers = 2
rails_root = ENV['RAILS_ROOT'] || "/home/lprelle/diaspora"

every 1.day, :at => '1am' do
num_sidekiq_workers.times do |num|
command "kill -USR1 $(cat #{rails_root}/pids/sidekiq#{num}.pid)"
end
end

every 1.day, :at => '1:01 am' do
num_sidekiq_workers.times do |num|
command "kill -TERM $(cat #{rails_root}/pids/sidekiq#{num}.pid)"
end
end
4 changes: 3 additions & 1 deletion script/diaspora.god
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ num_sidekiqworkers = 2

num_sidekiqworkers.times do |num|
God.watch do |w|
pid_file = File.join(rails_root, "pids/sidekiq#{num}.pid")

w.dir = "#{rails_root}"
w.name = "sidekiq-#{num}"
w.group = 'sidekiq'
w.interval = 190.seconds
w.env = {"QUEUE"=>"photos,receive_local,receive_salmon,receive,mail,socket_webfinger,delete_account,dispatch,http,http_service", "RAILS_ENV"=>rails_env}
w.start = "bundle exec sidekiq"
w.start = "bundle exec sidekiq -P #{pid_file}"

This comment has been minimized.

Copy link
@prellele

prellele Aug 11, 2014

Member

use clean command again, when configurable pid file dir is available
mojombo/god#174

w.log = "#{rails_root}/log/god.log"

#w.uid = 'lennart'
Expand Down

0 comments on commit 4b59a36

Please sign in to comment.