【问题标题】:Rails 5 - How to fix Middleware/Rack/ActionDispatch::Routing::RouteSet#call issue?Rails 5 - 如何修复 Middleware/Rack/ActionDispatch::Routing::RouteSet#call 问题?
【发布时间】:2018-01-23 12:24:06
【问题描述】:

在 rails 5 中,我使用 NewRelic 来监控应用程序。在 newrelic 中,我立即得到Middleware/Rack/ActionDispatch::Routing::RouteSet#call 作为最耗时的。我不知道为什么会出现这个问题。

在 routes.rb 中,

devise_for :admins
mount RailsAdmin::Engine => '/admin', as: 'rails_admin'
scope :api do
scope :v1 do
  devise_for :users, controllers: {
    registrations: 'users/registrations',
    confirmations: 'users/confirmations',
    sessions: 'users/sessions',
    passwords: 'users/passwords'
  }
  get 'confirm_user_email', to: 'user_emails#confirm_email', as: :confirm_user_email
  get 'forgot_password', to: 'landing_page#forgot_password'
  post 'send_invitation', to: 'users#send_invitation', as: :send_invitation
 end
end
unless Rails.env.production?
  mount LetterOpenerWeb::Engine, at: '/letter_opener'
end

require 'sidekiq/web'
mount Sidekiq::Web => '/sidekiq'
get "*path" => "home#index"

mount ActionCable.server => '/cable'

请帮我解决这个问题。

【问题讨论】:

  • 好吧,你检查过你的路由器了吗?
  • 是的。问题也更新了。
  • @ShruthiR 你找到解决方案了吗?我也面临同样的问题。请帮我弄清楚。
  • 抱歉,我也没有得到解决方案。
  • 我感觉它与 ActionCable 有关。我也有同样的情况,我正在将 ActionCable 用于实时更新页面。

标签: ruby-on-rails ruby performance routing newrelic


【解决方案1】:

请将newrelic_rpm 移动到 Gemfile 的底部。这是必需的,因为当服务器启动时,ruby 代理应该首先加载,然后是新的 relic 代理,以便可以通过新的 relic 代理路由事务调用,以便新的 relic 捕获事务。

【讨论】:

    猜你喜欢
    • 2018-03-29
    • 2015-04-05
    • 2015-04-10
    • 2015-10-06
    • 2011-09-21
    • 2015-07-19
    • 1970-01-01
    • 2023-04-08
    • 1970-01-01
    相关资源
    最近更新 更多