Rails在帖子上停留了很长时间

时间:2015-01-07 03:29:21

标签: ruby-on-rails

每次 POST 请求

卡住控制台需要大约10~20秒。

发生什么事了?如何描述它?

Started POST "/users" for 127.0.0.1 at 2015-01-07 11:20:43 +0800

这里的宝石被怀疑导致反应缓慢

gem 'quiet_assets'
gem "spring"
gem 'pry-rescue'
 gem 'pry-byebug'

development.rb

  # since you don't have to restart the web server when you make code changes.
  config.cache_classes = false

  # Do not eager load code on boot.
  config.eager_load = false

  # Show full error reports and disable caching.
  config.consider_all_requests_local       = true
  config.action_controller.perform_caching = false

  # Don't care if the mailer can't send.
  config.action_mailer.raise_delivery_errors = false

  # Print deprecation notices to the Rails logger.
  config.active_support.deprecation = :log

  # Raise an error on page load if there are pending migrations
  config.active_record.migration_error = :page_load

  # Debug mode disables concatenation and preprocessing of assets.
  # This option may cause significant delays in view rendering with a large
  # number of complex assets.
  config.assets.debug = true

  config.action_mailer.delivery_method = :smtp
  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.default :charset => "utf-8"

--------------

1 个答案:

答案 0 :(得分:0)

我遇到类似的问题,性能缓慢,资产变得越大,情况就越糟糕。解决方案是您在development.rb文件中设置为true的一行。

  

config.assets.debug = true

将其更改为 false ,您应该会看到很大的改进!