2ronwalf
2ronwalfnamespace :sidekiq do
2ronwalf
2ronwalf def kill(signal)
2ronwalf on roles(:app) do
2ronwalf execute "kill -s #{signal} `cat #{current_path}/tmp/pids/sidekiq*.pid` || true"
2ronwalf end
2ronwalf end
2ronwalf
2ronwalf desc "Stop sidekiq"
2ronwalf task :stop do
2ronwalf kill :TERM
2ronwalf end
2ronwalf
2ronwalf desc "Suspend sidekiq (stop accepting new work)"
2ronwalf task :suspend do
2ronwalf kill :USR1
2ronwalf end
2ronwalf
2ronwalf after 'deploy:starting', 'sidekiq:suspend'
2ronwalf
2ronwalf # god:terminate does this job already
2ronwalf #after 'deploy:publishing', 'sidekiq:stop'
2ronwalf
2ronwalfend
2ronwalf