Skip to content
This repository has been archived by the owner on Oct 16, 2019. It is now read-only.

Use resque-pool #161

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ gem "posix-spawn"
gem "warden-github-rails"
gem "faraday"
gem "faraday_middleware"
gem "resque-pool"

# Providers
gem "dpl", "1.5.7"
Expand Down
9 changes: 9 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ GEM
vegas (~> 0.1.2)
resque-lock-timeout (0.4.4)
resque (~> 1.22)
resque-pool (0.5.0)
rake
resque (~> 1.22)
trollop (~> 2.0)
rspec-core (2.14.7)
rspec-expectations (2.14.5)
diff-lcs (>= 1.1.3, < 2.0)
Expand Down Expand Up @@ -219,6 +223,7 @@ GEM
thor (0.19.1)
thread_safe (0.3.5)
tilt (1.4.1)
trollop (2.1.2)
tzinfo (1.2.2)
thread_safe (~> 0.1)
unicorn (4.8.2)
Expand Down Expand Up @@ -264,6 +269,7 @@ DEPENDENCIES
rails_12factor
resque
resque-lock-timeout
resque-pool
rspec-rails
rubocop
simplecov (= 0.7.1)
Expand All @@ -273,3 +279,6 @@ DEPENDENCIES
warden-github-rails
webmock
yajl-ruby

BUNDLED WITH
1.10.5
2 changes: 1 addition & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
web: bundle exec unicorn -p $PORT -c config/unicorn.rb
worker: bundle exec rake resque:work QUEUE=*
worker: TERM_CHILD=1 bundle exec resque-pool
10 changes: 10 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,14 @@

require File.expand_path("../config/application", __FILE__)

# this task will get called before resque:pool:setup
# and preload the rails environment in the pool manager
task "resque:pool:setup" do
# close any sockets or files in pool manager
ActiveRecord::Base.connection.disconnect!
Resque::Pool.after_prefork do
ActiveRecord::Base.establish_connection
end
end

Heaven::Application.load_tasks
2 changes: 2 additions & 0 deletions config/resque-pool.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
'*': <%= Integer(ENV["WORKER_CONCURRENCY"] || 2) %>
Binary file added vendor/cache/resque-pool-0.5.0.gem
Binary file not shown.
Binary file added vendor/cache/trollop-2.1.2.gem
Binary file not shown.