Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Identify slow requests#2305

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
jonodrew wants to merge14 commits intocodebar:master
base:master
Choose a base branch
Loading
fromjonodrew:identify-slow-requests

Conversation

@jonodrew
Copy link
Contributor

@jonodrewjonodrew commentedAug 24, 2025
edited
Loading

I'm not completely happy with this yet.

I've written some helper methods to grab all of the 'things' a member is attending and find them once, when the controller method is called. This replaces the map loop that generated two queries per event.

However, I think there's some clash here. The set of Event, Meeting, and Workshop ids will have some overlap and the tests will therefore be flakey. Advice welcome

This removes a call to '#attending?' for every workshop, instead creating a single method to generate the list.Running locally with a small sample, it reduced loading time for the homepage by 70%Signed-off-by: jonathan.kerr <3410350+jonodrew@users.noreply.github.com>
This now checks if the object passed to the Presenter is `nil` and responds accordingly. I've updated the logic in the dashboard_controller.rb to reflect the changeSigned-off-by: jonathan.kerr <3410350+jonodrew@users.noreply.github.com>
There feels like a lot of repetition here, but I can't figure out how to remove it right nowSigned-off-by: jonathan.kerr <3410350+jonodrew@users.noreply.github.com>
In order to use the MemberPresenter more flexibly, I want to remove the constant checking. The Presenter should be able to intialise with a `nil` object and then deal with the consequences of that. This approach will return `false` to any method not defined on the presenter or the presented object.Signed-off-by: jonathan.kerr <3410350+jonodrew@users.noreply.github.com>
Current count: 16 failures.Signed-off-by: jonathan.kerr <3410350+jonodrew@users.noreply.github.com>
Apply the method across the events area, in the same way we did for workshopsSigned-off-by: jonathan.kerr <3410350+jonodrew@users.noreply.github.com>
Signed-off-by: jonathan.kerr <3410350+jonodrew@users.noreply.github.com>
Signed-off-by: jonathan.kerr <3410350+jonodrew@users.noreply.github.com>
Currently we call `event_organiser` on every event when creating the dashboard. I've rewritten it to cache some of the things a user might be an organiser of.Signed-off-by: jonathan.kerr <3410350+jonodrew@users.noreply.github.com>
We don't need to check if a user is admin every single time, so I've cached the checkSigned-off-by: jonathan.kerr <3410350+jonodrew@users.noreply.github.com>
We don't need to load each chapter separately - let's get them all in one!Signed-off-by: jonathan.kerr <3410350+jonodrew@users.noreply.github.com>
@jonodrew
Copy link
ContributorAuthor

In total, this cuts loading the front page down to below 4s

Signed-off-by: jonathan.kerr <3410350+jonodrew@users.noreply.github.com>
Signed-off-by: jonathan.kerr <3410350+jonodrew@users.noreply.github.com>
@@ -0,0 +1,13 @@
# frozen_string_literal: true

moduleAttendanceConcerns
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

As this is one concern I think this should just be AttendanceConcern same for the file name so it matches the following:

  1. Rails autoloading expectations
  2. ActiveSupport::Concern conventions
  3. The rails generate concern behaviour

@davidmillen50
Copy link
Contributor

In total, this cuts loading the front page down to below 4s

I'm interested to know more about the savings you hope to make. I just loaded the production front page in 3.42s will your changes reduce that?

role.eql?('Coach') ?coach_pairing_details(note) :student_pairing_details(tutorial,note)
end


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

are these two spaces needed?

= link_to event.chapter.name, event.chapter.slug, class: 'text-light text-decoration-none'
- if@user
- if@user.attending?(event.__getobj__)
- if!attending_ids.blank?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

attending_ids.present? might be better here

- if @events.any?
%h3.mb-4 Upcoming Events
= render partial: 'events', locals: { grouped_events: @events}
= render partial: 'events', locals: { grouped_events: @events, attending_ids: @attending_ids}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I think you need a space before the closing}

%h5 Groups
%ul.list-unstyled.ms-0#subscriptions
- @member.groups.each do |group|
- member_groups = @member.groups
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I'd probably just do@member.groups.each etc

- if@user
- if@user.attending?(event.__getobj__)
- if!attending_ids.blank?
- ifattending_ids.include?(event.id)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

as you mentioned in the PR description, this seems problematic if there is a crossover of ids between different event types.

extendActiveSupport::Concern

defattending_workshops
current_user.nil? ?Set.new :current_user.workshop_invitations.accepted.pluck(:id).to_set
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@olleolleolleolleolleolleolleolleolle left review comments

+1 more reviewer

@davidmillen50davidmillen50davidmillen50 left review comments

Reviewers whose approvals may not affect merge requirements

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@jonodrew@davidmillen50@olleolleolle

[8]ページ先頭

©2009-2025 Movatter.jp