diff --git a/config/environments/development.rb b/config/environments/development.rb index 0051d171d..8329de4eb 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -23,6 +23,9 @@ Diaspora::Application.configure do config.active_support.deprecation = :log #config.threadsafe! + # Process jobs in process? + config.work_in_process = true + # Monkeypatch around the nasty "2.5MB exception page" issue, caused by very large environment vars # This snippet via: http://stackoverflow.com/questions/3114993/exception-pages-in-development-mode-take-upwards-of-15-30-seconds-to-render-why # Relevant Rails ticket: https://rails.lighthouseapp.com/projects/8994/tickets/5027-_request_and_responseerb-and-diagnosticserb-take-an-increasingly-long-time-to-render-in-development-with-multiple-show-tables-calls diff --git a/config/environments/production.rb b/config/environments/production.rb index f02ea6132..d38457c5b 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -47,6 +47,10 @@ Diaspora::Application.configure do # the I18n.default_locale when a translation can not be found) config.i18n.fallbacks = true config.threadsafe! + + # Process jobs in process? + #config.work_in_process = false + end # Sacrifice readability for a 10% performance boost diff --git a/config/initializers/resque.rb b/config/initializers/resque.rb index 94fe55ac4..48336f818 100644 --- a/config/initializers/resque.rb +++ b/config/initializers/resque.rb @@ -1,5 +1,14 @@ require File.join(Rails.root, 'app', 'models', 'jobs', 'base') Dir[File.join(Rails.root, 'app', 'models', 'jobs', '*.rb')].each { |file| require file } -#config = YAML::load(File.open("#{Rails.root}/config/redis.yml")) -#Resque.redis = Redis.new(:host => config['host'], :port => config['port']) + require 'resque' + +begin + if Diaspora::Application.config.work_in_process + module Resque + def enqueue(klass, *args) + klass.send(:perform, *args) + end + end + end +end diff --git a/script/server b/script/server index f2a2d2843..d94da6d15 100755 --- a/script/server +++ b/script/server @@ -121,7 +121,6 @@ if [ -n "$services" ]; then exit 64 fi - redis_config