rosa-build/lib/tasks/resque.rake

24 lines
649 B
Ruby
Raw Normal View History

namespace :resque do
desc 'Stop all Resque workers'
2014-01-21 04:51:49 +00:00
task stop_workers: :environment do
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
end