2012-06-29 14:09:06 +01:00
|
|
|
namespace :resque do
|
|
|
|
desc 'Stop all Resque workers'
|
2014-01-21 04:51:49 +00:00
|
|
|
task stop_workers: :environment do
|
2012-06-29 14:09:06 +01:00
|
|
|
pids = []
|
|
|
|
Resque.workers.each do |worker|
|
|
|
|
pids << worker.to_s.split(/:/).second
|
|
|
|
end
|
|
|
|
system("kill -QUIT #{pids.join(' ')}") if pids.size > 0
|
|
|
|
end
|
2014-02-26 20:50:39 +00:00
|
|
|
|
|
|
|
# This fixes connection fail with Postgres server on new fork:
|
|
|
|
task setup: :environment do
|
|
|
|
Resque.after_fork do
|
|
|
|
Resque.redis.client.reconnect
|
|
|
|
end
|
|
|
|
Resque.before_fork = Proc.new { ActiveRecord::Base.establish_connection }
|
|
|
|
end
|
|
|
|
|
|
|
|
task scheduler_setup: :environment do
|
|
|
|
Resque.schedule = YAML.load_file(Rails.root.join('config', 'resque_schedule.yml'))
|
|
|
|
end
|
|
|
|
|
2012-06-29 14:09:06 +01:00
|
|
|
end
|