From 1fd89260566eae1b8d3531bf83233eb18c27ab3d Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sat, 13 Oct 2012 09:54:34 -0700 Subject: Test that a Rails.queue consumer is automatically started in production --- railties/lib/rails/application/configuration.rb | 2 +- railties/lib/rails/application/finisher.rb | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'railties/lib/rails/application') diff --git a/railties/lib/rails/application/configuration.rb b/railties/lib/rails/application/configuration.rb index 2bcdb3d502..9b89d7094c 100644 --- a/railties/lib/rails/application/configuration.rb +++ b/railties/lib/rails/application/configuration.rb @@ -44,7 +44,7 @@ module Rails @autoflush_log = true @log_formatter = ActiveSupport::Logger::SimpleFormatter.new @queue = ActiveSupport::SynchronousQueue.new - @queue_consumer = ActiveSupport::ThreadedQueueConsumer + @queue_consumer = nil @eager_load = nil @assets = ActiveSupport::OrderedOptions.new diff --git a/railties/lib/rails/application/finisher.rb b/railties/lib/rails/application/finisher.rb index 26fca503a0..4a15a36ba9 100644 --- a/railties/lib/rails/application/finisher.rb +++ b/railties/lib/rails/application/finisher.rb @@ -98,7 +98,8 @@ module Rails initializer :activate_queue_consumer do |app| if config.queue.class == ActiveSupport::Queue - app.queue_consumer = config.queue_consumer.start + app.queue_consumer = config.queue_consumer || config.queue.consumer + app.queue_consumer.start at_exit { app.queue_consumer.shutdown } end end -- cgit v1.2.3