-
Notifications
You must be signed in to change notification settings - Fork 1
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
Enable strict loading globally #2771
Open
thomasleese
wants to merge
16
commits into
main
Choose a base branch
from
strict-loading
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains 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
thomasleese
force-pushed
the
strict-loading
branch
from
December 17, 2024 10:07
7691fde
to
28a09cd
Compare
thomasleese
force-pushed
the
strict-loading
branch
from
December 17, 2024 12:41
28a09cd
to
65fa060
Compare
thomasleese
force-pushed
the
strict-loading
branch
from
December 18, 2024 08:47
266213d
to
12d7b8e
Compare
thomasleese
force-pushed
the
strict-loading
branch
from
December 18, 2024 13:10
12d7b8e
to
33e1b16
Compare
thomasleese
added a commit
that referenced
this pull request
Dec 18, 2024
Instead of picking the last patient (which doesn't have a guaranteed order) we can pick the patient that will be left on the page, i.e. the patient that's missing attendance information. This has been extracted from #2771. Example failures: - https://github.com/nhsuk/manage-vaccinations-in-schools/actions/runs/12389409160/attempts/2 - https://github.com/nhsuk/manage-vaccinations-in-schools/actions/runs/12389403286/attempts/2
thomasleese
force-pushed
the
strict-loading
branch
from
December 19, 2024 12:11
33e1b16
to
6c26185
Compare
tvararu
approved these changes
Dec 20, 2024
thomasleese
force-pushed
the
strict-loading
branch
from
December 20, 2024 11:27
6c26185
to
8c41242
Compare
misaka
approved these changes
Dec 20, 2024
This refactors the factory to automatically pick a programme from the organisation if available to avoid creating new programmes when unnecessary.
This avoids unnecessary eager loading where it may not be required, instead we should use `includes` explicitly where needed.
This method is going to be removed to handle updates related to strict loading so we need to stop using this method in the tests.
This refactors the patient to avoid usage of the `parents` method and instead use `parent_relationships` directly, which then avoids the need to look up the relationship between the patient and the parent as it will already be accessible. This helps us to enable strict loading across the service by reducing the number of queries that need to be made.
This ensures that each time the method is called we don't perform an unnecessary query.
To `preload_for_status` to match the fact that the method is called `status` on the `PatientSession` model.
This enables global strict loading in development allowing us to catch potential N+1 issues before being deployed to production.
This allows us to run the tests with strict loading enabled automatically, allowing us to catch any potential N+1 issues before they go out to production.
Now that strict loading is enabled globally in development and test we can remove explicit calls to enable strict loading.
This updates the component to preload the necessary data from the database before rendering to avoid N+1 issues.
This updates the component to preload the necessary data from the database before rendering to avoid N+1 issues.
Now that strict loading is enabled across the service we can use the feature tests to find the majority of the N+1 issues and fix them until the feature tests pass.
This updates various tests to fix N+1 issues that are triggered by strict loading being enabled globally.
This disables strict loading in various model and component tests where fixing the N+1 issues would require more work than is worth just for the tests.
This fixes an N+1 issue in the seeds that is raised now that strict loading has been enabled globally.
thomasleese
force-pushed
the
strict-loading
branch
from
December 20, 2024 14:37
8c41242
to
0af55c8
Compare
Quality Gate passedIssues Measures |
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.
This enables the Rails strict loading feature across the whole codebase while running in the development or test environments, allowing us to catch potential N+1 issues before they make it to production. I've also disabled strict loading in production so if any N+1 issues do make it through, it's going to lead to low performance rather than an unhandled exception.