perf: preload members for meeting attendees list - #2961
Merged
Merged
Conversation
MeetingsController#show built the attendees relation without preloading member, so the attendee list on the show page issued one members query per attending invitation (63 queries at p50, 93 at p95 in production). Add includes(:member) and guard the fix with a query-count regression spec following the pattern in event_card_render_query_cost_spec. Closes #2953
Bullet is the repo's N+1 guard (on-demand via bullet's logger/console in development), so a dedicated query-count spec duplicates that coverage and costs test runtime on every run.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2953
Problem
MeetingsController#showbuilds@attendeeswithout preloading members:The
show.html.hamlview callsattendee.member.avatar(56)andattendee.member.full_nameper row, so each attendee triggers a separatemembersquery. Production logs (7 days to 2026-09-27) show 63 queries atp50 and 93 at p95 for
MeetingsController#show.Change
Add
.includes(:member)to the attendees relation. No new specs: Bullet isthe repo's N+1 guard and can be run on demand, so a dedicated query-count
spec would duplicate that coverage on every test run.
Checked but not changed
members/organisers_grid(@meeting.organisers): the partial only callsmember.avatar(Gravatar string) andmember.full_name(attribute), sothere is no per-member database cost.
sanitize(@meeting.description)runs per render; left as is. Sametreatment as Workshop show pages allocate ~7.3k objects per request with no caching (28% of app allocations)聽#2951 applies if wanted, but that is out of scope here.
Verification
GET /meetings/:slugwith the preload in place, and flags the memberquery per attendee without it.
spec/models/meeting_spec.rb,spec/models/meeting_invitation_spec.rb,spec/presenters/meeting_presenter_spec.rb: 52 examples, 0 failures.