Commit c25d8abd authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'al-196720-remove-destroy_user_associations_in_batches-ff' into 'master'

Remove destroy_user_associations_in_batches flag

See merge request gitlab-org/gitlab!24641
parents 8bb85704 c8a30806
...@@ -56,12 +56,10 @@ module Users ...@@ -56,12 +56,10 @@ module Users
MigrateToGhostUserService.new(user).execute unless options[:hard_delete] 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 # Rails attempts to load all related records into memory before
# destroying: https://github.com/rails/rails/issues/22510 # destroying: https://github.com/rails/rails/issues/22510
# This ensures we delete records in batches. # This ensures we delete records in batches.
user.destroy_dependent_associations_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 # Destroy the namespace after destroying the user since certain methods may depend on the namespace existing
user_data = user.destroy user_data = user.destroy
......
---
title: Destroy user associations in batches like we do with projects
merge_request: 24641
author:
type: performance
...@@ -26,16 +26,6 @@ describe Users::DestroyService do ...@@ -26,16 +26,6 @@ describe Users::DestroyService do
service.execute(user) service.execute(user)
end end
context 'when :destroy_user_associations_in_batches flag is disabled' do
it 'does not delete user associations in batches' do
stub_feature_flags(destroy_user_associations_in_batches: false)
expect(user).not_to receive(:destroy_dependent_associations_in_batches)
service.execute(user)
end
end
it 'will delete the project' do it 'will delete the project' do
expect_next_instance_of(Projects::DestroyService) do |destroy_service| expect_next_instance_of(Projects::DestroyService) do |destroy_service|
expect(destroy_service).to receive(:execute).once.and_return(true) expect(destroy_service).to receive(:execute).once.and_return(true)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment