email via sidekiq. start and stop rake tasks
This commit is contained in:
parent
c7bb3a1f72
commit
71bd956866
15 changed files with 36 additions and 46 deletions
|
@ -1,23 +0,0 @@
|
|||
require 'resque/tasks'
|
||||
|
||||
namespace :resque do
|
||||
task setup: :environment do
|
||||
#Resque.before_fork = Proc.new { ActiveRecord::Base.establish_connection }
|
||||
end
|
||||
|
||||
desc "Resque | kill all workers (using -QUIT), god will take care of them"
|
||||
task :stop_workers => :environment do
|
||||
#pids = Array.new
|
||||
|
||||
#Resque.workers.each do |worker|
|
||||
#pids << worker.to_s.split(/:/).second
|
||||
#end
|
||||
|
||||
#if pids.size > 0
|
||||
#system("kill -QUIT #{pids.join(' ')}")
|
||||
#end
|
||||
end
|
||||
end
|
||||
|
||||
desc "Alias for resque:work (To run workers on Heroku)"
|
||||
task "jobs:work" => "resque:work"
|
23
lib/tasks/sidekiq.rake
Normal file
23
lib/tasks/sidekiq.rake
Normal file
|
@ -0,0 +1,23 @@
|
|||
namespace :sidekiq do
|
||||
desc "GITLAB | Stop sidekiq"
|
||||
task :stop do
|
||||
run "bundle exec sidekiqctl stop #{pidfile}"
|
||||
end
|
||||
|
||||
desc "GITLAB | Start sidekiq"
|
||||
task :start do
|
||||
run "nohup bundle exec sidekiq -q post_receive,mailer,system_hook,common,default -e #{rails_env} -P #{pidfile} >> #{root_path}/log/sidekiq.log 2>&1 &"
|
||||
end
|
||||
|
||||
def root_path
|
||||
@root_path ||= File.join(File.expand_path(File.dirname(__FILE__)), "../..")
|
||||
end
|
||||
|
||||
def pidfile
|
||||
"#{root_path}/tmp/pids/sidekiq.pid"
|
||||
end
|
||||
|
||||
def rails_env
|
||||
ENV['RAILS_ENV'] || "production"
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue