Use gitlab resque fork. Added rake task to stop all workers
This commit is contained in:
parent
3b1519da47
commit
5cd823847b
3 changed files with 29 additions and 14 deletions
2
Gemfile
2
Gemfile
|
@ -77,7 +77,7 @@ gem "acts-as-taggable-on", "2.3.3"
|
||||||
gem "draper", "~> 0.18.0"
|
gem "draper", "~> 0.18.0"
|
||||||
|
|
||||||
# Background jobs
|
# Background jobs
|
||||||
gem "resque", git: "https://github.com/defunkt/resque.git", ref: "9ef4700306dd946a3ac000612428967ce0c32213"
|
gem "resque", git: "https://github.com/gitlabhq/resque.git", ref: "9ef4700306dd946a3ac000612428967ce0c32213"
|
||||||
gem 'resque_mailer'
|
gem 'resque_mailer'
|
||||||
|
|
||||||
# HTTP requests
|
# HTTP requests
|
||||||
|
|
22
Gemfile.lock
22
Gemfile.lock
|
@ -13,17 +13,6 @@ GIT
|
||||||
activerecord (>= 2.3.0)
|
activerecord (>= 2.3.0)
|
||||||
rake (>= 0.8.7)
|
rake (>= 0.8.7)
|
||||||
|
|
||||||
GIT
|
|
||||||
remote: https://github.com/defunkt/resque.git
|
|
||||||
revision: 9ef4700306dd946a3ac000612428967ce0c32213
|
|
||||||
ref: 9ef4700306dd946a3ac000612428967ce0c32213
|
|
||||||
specs:
|
|
||||||
resque (2.0.0.pre.1)
|
|
||||||
json
|
|
||||||
redis-namespace (~> 1.0)
|
|
||||||
sinatra (>= 0.9.2)
|
|
||||||
vegas (~> 0.1.2)
|
|
||||||
|
|
||||||
GIT
|
GIT
|
||||||
remote: https://github.com/gitlabhq/grack.git
|
remote: https://github.com/gitlabhq/grack.git
|
||||||
revision: ba46f3b0845c6a09d488ae6abdce6ede37e227e8
|
revision: ba46f3b0845c6a09d488ae6abdce6ede37e227e8
|
||||||
|
@ -70,6 +59,17 @@ GIT
|
||||||
posix-spawn (~> 0.3.6)
|
posix-spawn (~> 0.3.6)
|
||||||
yajl-ruby (~> 1.1.0)
|
yajl-ruby (~> 1.1.0)
|
||||||
|
|
||||||
|
GIT
|
||||||
|
remote: https://github.com/gitlabhq/resque.git
|
||||||
|
revision: 9ef4700306dd946a3ac000612428967ce0c32213
|
||||||
|
ref: 9ef4700306dd946a3ac000612428967ce0c32213
|
||||||
|
specs:
|
||||||
|
resque (2.0.0.pre.1)
|
||||||
|
json
|
||||||
|
redis-namespace (~> 1.0)
|
||||||
|
sinatra (>= 0.9.2)
|
||||||
|
vegas (~> 0.1.2)
|
||||||
|
|
||||||
GIT
|
GIT
|
||||||
remote: https://github.com/gitlabhq/yaml_db.git
|
remote: https://github.com/gitlabhq/yaml_db.git
|
||||||
revision: 98e9a5dca43e3fedd3268c76a73af40d1bdf1dfd
|
revision: 98e9a5dca43e3fedd3268c76a73af40d1bdf1dfd
|
||||||
|
|
|
@ -1,7 +1,22 @@
|
||||||
require 'resque/tasks'
|
require 'resque/tasks'
|
||||||
|
|
||||||
task "resque:setup" => :environment do
|
namespace :resque do
|
||||||
|
task setup: :environment do
|
||||||
Resque.before_fork = Proc.new { ActiveRecord::Base.establish_connection }
|
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
|
end
|
||||||
|
|
||||||
desc "Alias for resque:work (To run workers on Heroku)"
|
desc "Alias for resque:work (To run workers on Heroku)"
|
||||||
|
|
Loading…
Add table
Reference in a new issue