diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2012-09-10 12:52:19 -0700 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2012-09-11 15:11:52 -0700 |
commit | 34b23e7110a3a13cf157608cefc9b5701017bf39 (patch) | |
tree | 1b4f9962bddde61a8f7239b8a49b06e4c04f3429 /railties | |
parent | b4b5971ff73f3191be03644fa0c9951a930717d2 (diff) | |
download | rails-34b23e7110a3a13cf157608cefc9b5701017bf39.tar.gz rails-34b23e7110a3a13cf157608cefc9b5701017bf39.tar.bz2 rails-34b23e7110a3a13cf157608cefc9b5701017bf39.zip |
Action Mailer async flag is true by default using a Synchronous impl
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/rails/application/configuration.rb | 2 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/config/application.rb | 3 | ||||
-rw-r--r-- | railties/lib/rails/queueing.rb | 8 |
3 files changed, 9 insertions, 4 deletions
diff --git a/railties/lib/rails/application/configuration.rb b/railties/lib/rails/application/configuration.rb index 0202e86f32..7a0bb21043 100644 --- a/railties/lib/rails/application/configuration.rb +++ b/railties/lib/rails/application/configuration.rb @@ -41,7 +41,7 @@ module Rails @exceptions_app = nil @autoflush_log = true @log_formatter = ActiveSupport::Logger::SimpleFormatter.new - @queue = Rails::Queueing::Queue + @queue = Rails::Queueing::SynchronousQueue @queue_consumer = Rails::Queueing::ThreadedConsumer @eager_load = nil diff --git a/railties/lib/rails/generators/rails/app/templates/config/application.rb b/railties/lib/rails/generators/rails/app/templates/config/application.rb index 1ac0248bcf..09b08d5663 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/application.rb +++ b/railties/lib/rails/generators/rails/app/templates/config/application.rb @@ -59,8 +59,5 @@ module <%= app_const_base %> # Version of your assets, change this if you want to expire all your assets. config.assets.version = '1.0' <% end -%> - - # Enable app-wide asynchronous ActionMailer. - # config.action_mailer.async = true end end diff --git a/railties/lib/rails/queueing.rb b/railties/lib/rails/queueing.rb index baf6811d3e..7cd755b0f7 100644 --- a/railties/lib/rails/queueing.rb +++ b/railties/lib/rails/queueing.rb @@ -35,6 +35,14 @@ module Rails class Queue < ::Queue end + class SynchronousQueue < ::Queue + def push(job) + job.run + end + alias << push + alias enq push + end + # In test mode, the Rails queue is backed by an Array so that assertions # can be made about its contents. The test queue provides a +jobs+ # method to make assertions about the queue's contents and a +drain+ |