add possibility to embed a resque worker into the unicorn process
This commit is contained in:
parent
89c1fd5f7f
commit
ce728f6b7b
3 changed files with 15 additions and 1 deletions
|
|
@ -22,6 +22,8 @@ defaults:
|
||||||
region:
|
region:
|
||||||
image_redirect_url:
|
image_redirect_url:
|
||||||
pubsub_server: 'https://pubsubhubbub.appspot.com/'
|
pubsub_server: 'https://pubsubhubbub.appspot.com/'
|
||||||
|
unicorn:
|
||||||
|
embed_resque_worker: false
|
||||||
privacy:
|
privacy:
|
||||||
jquery_cdn: true
|
jquery_cdn: true
|
||||||
google_analytics_key:
|
google_analytics_key:
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,11 @@ configuration:
|
||||||
## Diaspora is only tested against this default pubsub server.
|
## Diaspora is only tested against this default pubsub server.
|
||||||
## You likely don't want to change this.
|
## You likely don't want to change this.
|
||||||
#pubsub_server: 'https://pubsubhubbub.appspot.com/'
|
#pubsub_server: 'https://pubsubhubbub.appspot.com/'
|
||||||
|
|
||||||
|
unicorn:
|
||||||
|
## Embed a resque worker inside the unicorn process, useful for
|
||||||
|
## minimal Heroku setups
|
||||||
|
#embed_resque_worker: true
|
||||||
|
|
||||||
## Settings probably affecting the privacy of your users
|
## Settings probably affecting the privacy of your users
|
||||||
privacy:
|
privacy:
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,8 @@ preload_app true
|
||||||
# How long to wait before killing an unresponsive worker
|
# How long to wait before killing an unresponsive worker
|
||||||
timeout 30
|
timeout 30
|
||||||
|
|
||||||
|
@resque_pid = nil
|
||||||
|
|
||||||
#pid '/var/run/diaspora/diaspora.pid'
|
#pid '/var/run/diaspora/diaspora.pid'
|
||||||
#listen '/var/run/diaspora/diaspora.sock', :backlog => 2048
|
#listen '/var/run/diaspora/diaspora.sock', :backlog => 2048
|
||||||
|
|
||||||
|
|
@ -29,6 +31,12 @@ before_fork do |server, worker|
|
||||||
if !AppConfig.single_process_mode?
|
if !AppConfig.single_process_mode?
|
||||||
Resque.redis.client.disconnect
|
Resque.redis.client.disconnect
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if AppConfig.environment.unicorn.embed_resque_worker?
|
||||||
|
# Clean up Resque workers killed by previous deploys/restarts
|
||||||
|
Resque.workers.each { |w| w.unregister_worker }
|
||||||
|
@resque_pid ||= spawn('bundle exec rake resque:work QUEUES=*')
|
||||||
|
end
|
||||||
|
|
||||||
old_pid = '/var/run/diaspora/diaspora.pid.oldbin'
|
old_pid = '/var/run/diaspora/diaspora.pid.oldbin'
|
||||||
if File.exists?(old_pid) && server.pid != old_pid
|
if File.exists?(old_pid) && server.pid != old_pid
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue