Skip to content
Extraits de code Groupes Projets
Valider ce728f6b rédigé par Jonne Haß's avatar Jonne Haß
Parcourir les fichiers

add possibility to embed a resque worker into the unicorn process

parent 89c1fd5f
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -22,6 +22,8 @@ defaults: ...@@ -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: ...@@ -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 ...@@ -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| ...@@ -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
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter