Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop pre-loading accredited course list associations #4708

Merged
merged 2 commits into from
Nov 22, 2024

Conversation

Nitemaeric
Copy link
Contributor

@Nitemaeric Nitemaeric commented Nov 22, 2024

Context

The accredited provider's download of all courses they ratify times out for some providers. We need to investigate the cause and how to fix it.

Changes proposed in this pull request

  • Remove .includes call when loading the accredited course list. More information in commit message: 137a46e
  • Change the program type re-assignment based on fee to run before a database write occurs. (While testing the spec/services/exports/accredited_course_list_spec.rb spec, it would fail course.program_type == course.program_type. This is because one of the instances was taken from the database, one ran the after_save callback.

Guidance to review

@Nitemaeric Nitemaeric force-pushed the dd/optimise-accredited-course-list-export branch from 566c4d2 to d89e977 Compare November 22, 2024 13:14
Pre-loading the accredited course list associations slows down the entire response time by 10x.

This is likely due to ineffective indexes - To be investigated further.
@Nitemaeric Nitemaeric force-pushed the dd/optimise-accredited-course-list-export branch 3 times, most recently from cbf3d15 to 2640668 Compare November 22, 2024 13:53
`after_save :update_program_type!` sets the program type after the record has been saved to the database. This doesn't update the database record unless it is saved again.
@Nitemaeric Nitemaeric force-pushed the dd/optimise-accredited-course-list-export branch from 2640668 to b6b7042 Compare November 22, 2024 14:01
@Nitemaeric Nitemaeric self-assigned this Nov 22, 2024
@Nitemaeric Nitemaeric marked this pull request as ready for review November 22, 2024 14:08
@Nitemaeric Nitemaeric requested a review from a team as a code owner November 22, 2024 14:08
Copy link
Contributor

@tomas-stefano tomas-stefano left a comment

Choose a reason for hiding this comment

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

🚀

@Nitemaeric Nitemaeric merged commit 13e68c5 into main Nov 22, 2024
19 checks passed
@Nitemaeric Nitemaeric deleted the dd/optimise-accredited-course-list-export branch November 22, 2024 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants