casa
casa copied to clipboard
Fix bullet n+1 issues in tests
Remove and fix each test with :disable_bullet
one by one :)
@littleforest Are you working on this or can I take it?
@bjthompson805 you can take it!
@compwron I'm really new to Rails and wondering if you could help me figure out where this call is being made that I can add .includes([:logo_attachment])
as it is suggesting. Here is what 99% of the errors are the first time I ran with Bullet.raise = true
, any help is appreciated!:
Bullet::Notification::UnoptimizedQueryError:
user: root
GET /casa_cases
USE eager loading detected
CasaOrg => [:logo_attachment]
Add to your query: .includes([:logo_attachment])
Call stack
/usr/src/app/app/views/layouts/_sidebar.html.erb:3:in `_app_views_layouts__sidebar_html_erb__493316934298706686_51240'
/usr/src/app/app/views/layouts/application.html.erb:38:in `_app_views_layouts_application_html_erb__199189227000836964_51180'
/usr/src/app/spec/system/casa_cases/index_spec.rb:17:in `block (2 levels) in <top (required)>'
@bjthompson805 these can be tricky. In this case it should go on the in_organization
scope in the users model:
scope :in_organization, lambda { |org|
where(casa_org_id: org.id).includes(casa_org: :logo_attachment)
}
This issue has been inactive for 143 hours (5.96 days) and will be automatically unassigned after 25 more hours (1.04 days).
@bjthompson805 since I commented 3 days ago, shouldn't this not get marked as inactive?
Yeah it shouldn't. I'll look into that.
@littleforest I fixed the issue, let me know if you see anything else.
Great, thanks @bjthompson805 !
This issue has been inactive for 123 hours (5.13 days) and will be automatically unassigned after 45 more hours (1.88 days).
This issue has been inactive for 171 hours (7.13 days) and is past the limit of 168 hours (7.00 days) so is being unassigned.
This issue has been open without changes for a long time! What's up?
Has this issue been resolved?
Nope! There was a very weird issue I found with the logo, which maybe I can pair with you if you are interested in working on this. Since the logo is loaded on pretty much every page, it was affecting nearly every spec.
@Luke-kb maybe this has been fixed??? Not sure. It looks like Bullet.enable = true
and Bullet.raise = true
in the config/environments/test.rb
file. There is an override for SKIP_BULLET
, but it does not look like that is set in CI. Can you make sure that SKIP_BULLET
is NOT set in your local .env
file and that the specs run okay? I will try to look at it in more detail later too. Maybe remove an includes
statement and make sure you can get the specs to trip on an N+1 issue.
closing this for now because we don't have any bullet skips anymore!