Commit 5cd823847b37c66d521545180c81d9a92ca0ab57
1 parent
3b1519da
Exists in
master
and in
4 other branches
Use gitlab resque fork. Added rake task to stop all workers
Showing
3 changed files
with
29 additions
and
14 deletions
Show diff stats
Gemfile
... | ... | @@ -77,7 +77,7 @@ gem "acts-as-taggable-on", "2.3.3" |
77 | 77 | gem "draper", "~> 0.18.0" |
78 | 78 | |
79 | 79 | # Background jobs |
80 | -gem "resque", git: "https://github.com/defunkt/resque.git", ref: "9ef4700306dd946a3ac000612428967ce0c32213" | |
80 | +gem "resque", git: "https://github.com/gitlabhq/resque.git", ref: "9ef4700306dd946a3ac000612428967ce0c32213" | |
81 | 81 | gem 'resque_mailer' |
82 | 82 | |
83 | 83 | # HTTP requests | ... | ... |
Gemfile.lock
... | ... | @@ -14,17 +14,6 @@ GIT |
14 | 14 | rake (>= 0.8.7) |
15 | 15 | |
16 | 16 | GIT |
17 | - remote: https://github.com/defunkt/resque.git | |
18 | - revision: 9ef4700306dd946a3ac000612428967ce0c32213 | |
19 | - ref: 9ef4700306dd946a3ac000612428967ce0c32213 | |
20 | - specs: | |
21 | - resque (2.0.0.pre.1) | |
22 | - json | |
23 | - redis-namespace (~> 1.0) | |
24 | - sinatra (>= 0.9.2) | |
25 | - vegas (~> 0.1.2) | |
26 | - | |
27 | -GIT | |
28 | 17 | remote: https://github.com/gitlabhq/grack.git |
29 | 18 | revision: ba46f3b0845c6a09d488ae6abdce6ede37e227e8 |
30 | 19 | ref: ba46f3b0845c6a09d488ae6abdce6ede37e227e8 |
... | ... | @@ -71,6 +60,17 @@ GIT |
71 | 60 | yajl-ruby (~> 1.1.0) |
72 | 61 | |
73 | 62 | GIT |
63 | + remote: https://github.com/gitlabhq/resque.git | |
64 | + revision: 9ef4700306dd946a3ac000612428967ce0c32213 | |
65 | + ref: 9ef4700306dd946a3ac000612428967ce0c32213 | |
66 | + specs: | |
67 | + resque (2.0.0.pre.1) | |
68 | + json | |
69 | + redis-namespace (~> 1.0) | |
70 | + sinatra (>= 0.9.2) | |
71 | + vegas (~> 0.1.2) | |
72 | + | |
73 | +GIT | |
74 | 74 | remote: https://github.com/gitlabhq/yaml_db.git |
75 | 75 | revision: 98e9a5dca43e3fedd3268c76a73af40d1bdf1dfd |
76 | 76 | ref: 98e9a5dca43e3fedd3268c76a73af40d1bdf1dfd | ... | ... |
lib/tasks/resque.rake
1 | 1 | require 'resque/tasks' |
2 | 2 | |
3 | -task "resque:setup" => :environment do | |
4 | - Resque.before_fork = Proc.new { ActiveRecord::Base.establish_connection } | |
3 | +namespace :resque do | |
4 | + task setup: :environment do | |
5 | + Resque.before_fork = Proc.new { ActiveRecord::Base.establish_connection } | |
6 | + end | |
7 | + | |
8 | + desc "Resque | kill all workers (using -QUIT), god will take care of them" | |
9 | + task :stop_workers => :environment do | |
10 | + pids = Array.new | |
11 | + | |
12 | + Resque.workers.each do |worker| | |
13 | + pids << worker.to_s.split(/:/).second | |
14 | + end | |
15 | + | |
16 | + if pids.size > 0 | |
17 | + system("kill -QUIT #{pids.join(' ')}") | |
18 | + end | |
19 | + end | |
5 | 20 | end |
6 | 21 | |
7 | 22 | desc "Alias for resque:work (To run workers on Heroku)" | ... | ... |