rails / mission_control-jobs

Dashboard and Active Job extensions to operate and troubleshoot background jobs
MIT License
611 stars 71 forks source link

N+1 #143

Open Dandush03 opened 3 months ago

Dandush03 commented 3 months ago

Must views have N+1 issues, I recomend using Bullet to find the out.

rosa commented 3 months ago

Hey @Dandush03, thanks for reporting! I'm aware of that, since Mission Control was designed to work with multiple adapters that are totally different (Resque vs. Solid Queue right now), it's not as straightforward to address these. If you'd like to contribute a PR with some fixes, they'd be very welcome.

searls commented 3 months ago

In the meantime, I have disabled my controller-level N+1 detector (prosopite) so it doesn't warn/error when I'm at mission control:

Example of how using controller_path on a hook condition:

# app/controllers/application_controller.rb
if Rails.env.development?
  Prosopite.rails_logger = true
  around_action :n_plus_one_detection, unless: -> { controller_path.starts_with?("mission_control") }

  def n_plus_one_detection
    Prosopite.scan
    yield
  ensure
    Prosopite.finish
  end
end