From 58083d6cbb0dfacd7584a79614fc888673f0989a Mon Sep 17 00:00:00 2001 From: James Mead Date: Tue, 28 Apr 2026 16:13:17 +0100 Subject: [PATCH] Remove unused method in PatientStatusUpdater This method implementation and an invocation from `PatientStatusUpdater#update_programme_statuses!` was originally added in this commit [1] in #6468. Both the implementation and invocation were removed in this commit [2] in #6611. Then the implementation was then re-added without the corresponding invocation in this commit [3] within #6677 which was the "Version 8.1.0" pull request. Since the method is never invoked, it's safe to remove it. [1]: https://github.com/NHSDigital/manage-vaccinations-in-schools/commit/25e876a72c6ce58ce340572904fe9d7d16958ed2 [2]: https://github.com/NHSDigital/manage-vaccinations-in-schools/commit/29460d4a15a3230234ae24ac04babb2609ba2c8c [3]: https://github.com/NHSDigital/manage-vaccinations-in-schools/commit/c66b75728a3d2b0d0e0fa3a42f73a245e301c244 --- app/lib/patient_status_updater.rb | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/app/lib/patient_status_updater.rb b/app/lib/patient_status_updater.rb index 6d7d948299..a5880585c3 100644 --- a/app/lib/patient_status_updater.rb +++ b/app/lib/patient_status_updater.rb @@ -160,23 +160,4 @@ def programme_types_per_session_id_and_year_group hash[session_id][year_group] << programme_type end end - - # We preload this association separately because including it in the nested - # `patient_locations` preload (see includes above) caused the updater process - # to be killed, even with very small batches. The likely cause is memory pressure - # from eager loading a deeply nested association graph. - # - # Preloading it here for the distinct `Location` records in each batch keeps - # `StatusGenerator::Programme` query-free without incurring the cost of the - # larger nested preload. - def preload_location_programme_year_groups(batch) - locations = batch.flat_map(&:patient_locations).map(&:location).uniq - - ActiveRecord::Associations::Preloader.new( - records: locations, - associations: { - location_programme_year_groups: :location_year_group - } - ).call - end end