resque.rake 571 Bytes
Newer Older
1
require 'resque/tasks'
Andrey Kumanyaev's avatar
Andrey Kumanyaev committed
2

3
4
namespace :resque do
  task setup: :environment do
Dmitriy Zaporozhets's avatar
sidekiq    
Dmitriy Zaporozhets committed
5
    #Resque.before_fork = Proc.new { ActiveRecord::Base.establish_connection }
6
7
8
9
  end

  desc "Resque | kill all workers (using -QUIT), god will take care of them"
  task :stop_workers => :environment do
Dmitriy Zaporozhets's avatar
sidekiq    
Dmitriy Zaporozhets committed
10
    #pids = Array.new
11

Dmitriy Zaporozhets's avatar
sidekiq    
Dmitriy Zaporozhets committed
12
13
14
    #Resque.workers.each do |worker|
      #pids << worker.to_s.split(/:/).second
    #end
15

Dmitriy Zaporozhets's avatar
sidekiq    
Dmitriy Zaporozhets committed
16
17
18
    #if pids.size > 0
      #system("kill -QUIT #{pids.join(' ')}")
    #end
19
  end
Andrey Kumanyaev's avatar
Andrey Kumanyaev committed
20
21
22
23
end

desc "Alias for resque:work (To run workers on Heroku)"
task "jobs:work" => "resque:work"