summaryrefslogtreecommitdiff
path: root/app/services/users
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-14 15:07:55 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-14 15:07:55 +0000
commit85e494935a8726dc98bb19ffa584488420e5011e (patch)
tree5acf279dab81a2363e4504a9679c32c16510542b /app/services/users
parent4ce0bee95df15c05cdb0d777eba31fe753bc443b (diff)
downloadgitlab-ce-85e494935a8726dc98bb19ffa584488420e5011e.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/users')
-rw-r--r--app/services/users/destroy_service.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/services/users/destroy_service.rb b/app/services/users/destroy_service.rb
index e341c7f0537..643ebdc6839 100644
--- a/app/services/users/destroy_service.rb
+++ b/app/services/users/destroy_service.rb
@@ -56,6 +56,13 @@ module Users
MigrateToGhostUserService.new(user).execute unless options[:hard_delete]
+ if Feature.enabled?(:destroy_user_associations_in_batches)
+ # Rails attempts to load all related records into memory before
+ # destroying: https://github.com/rails/rails/issues/22510
+ # This ensures we delete records in batches.
+ user.destroy_dependent_associations_in_batches
+ end
+
# Destroy the namespace after destroying the user since certain methods may depend on the namespace existing
user_data = user.destroy
namespace.destroy