FrozenError on profile/user delete - #1136
Merged
Merged
Conversation
fbacall
approved these changes
Aug 27, 2025
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.
Summary of changes
profile.rb: calling reindex_trainer only when creating and updating, not deleting.Motivation and context
When deleting a user, a FrozenError was raised, this is due to the
reindex_trainermethod of theProfilemodel being called after a commit.Discussions
One question raised by Finn was "we need to check what happens to the search index when the profile is deleted (e.g. does it cause an error because the profile is returned from the search service but can't be found in the database anymore)"
a. They are present in table users, not in table profiles, not in solr
b. Deleting does the FrozenError
c. Then they are not present in db anymore (nor in solr)
a. Present in Profile solr search (in rails console, Profile.where)
b. Deleting does the FrozenError, then not present in solr search (Profile)
a. After updating as a trainer, they are present in a Trainers solr search (in rails console, Trainer.search { fulltext 'Kenneth' }.results)
b. Deleting does the FrozenError, then they are both not present in db and in solr search (either in Trainer nor in Profile)
Redoing it with the amended callback
after_commit :reindex_trainer, on: %i[create update]a. Not found in Solr search
b. After deleting, no more FE
c. Not present in db nor solr search
a. Not found in Solr search (Profile and Trainer)
b. After deleting, no more FE
c. Not present in db nor solr search
a. Searchable through Trainer.search
b. After deleting, no FE
c. Not present in db, and Trainer.search does not find anything
Checklist
to license it to the TeSS codebase under the
BSD license.